forked from MDCPS/DamageAssessment_Backend
Copy from old Repository
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DamageAssesment.Api.Questions.Db
|
||||
{
|
||||
public class Question
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[ForeignKey("QuestionType")]
|
||||
public int QuestionTypeId { get; set; }
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
|
||||
//uncomment below propertiers
|
||||
public int QuestionNumber { get; set; }
|
||||
public bool IsRequired { get; set; }
|
||||
public bool Comment { get; set; } //if Comment is true answer has user comment (survey response)
|
||||
|
||||
public bool Key { get; set; }
|
||||
[ForeignKey("Survey")]
|
||||
public int? SurveyId { get; set; }
|
||||
public string QuestionGroup { get; set; }
|
||||
[ForeignKey("QuestionCategory")]
|
||||
public int CategoryId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System.Buffers.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DamageAssesment.Api.Questions.Db
|
||||
{
|
||||
public class QuestionCategory
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string CategoryName { get; set; }
|
||||
public string CategoryImage { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DamageAssesment.Api.Questions.Db
|
||||
{
|
||||
public class QuestionDbContext : DbContext
|
||||
{
|
||||
public DbSet<Db.Question> Questions { get; set; }
|
||||
public DbSet<Db.QuestionType> QuestionTypes { get; set; }
|
||||
public DbSet<Db.QuestionsTranslation> QuestionsTranslations { get; set; }
|
||||
public DbSet<Db.QuestionCategory> QuestionCategories { get; set; }
|
||||
public QuestionDbContext(DbContextOptions options) : base(options)
|
||||
{
|
||||
|
||||
}
|
||||
//protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
//{
|
||||
// modelBuilder.Entity<Question>()
|
||||
// .HasOne(a => a.QuestionType)
|
||||
// .WithOne(b => b.Question)
|
||||
// .HasForeignKey<QuestionType>(b => b.QuestionTypeID);
|
||||
//}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DamageAssesment.Api.Questions.Db
|
||||
{
|
||||
public class QuestionType
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string TypeText { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DamageAssesment.Api.Questions.Db
|
||||
{
|
||||
public class QuestionsTranslation
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[ForeignKey("Question")]
|
||||
public int QuestionId { get; set; }
|
||||
public string QuestionText { get; set; }
|
||||
public string Language { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user