Merged new dev changes

This commit is contained in:
uppuv
2023-09-13 13:16:42 -04:00
137 changed files with 2247 additions and 1254 deletions

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DamageAssesment.Api.Surveys.Db
{
@ -6,23 +7,20 @@ namespace DamageAssesment.Api.Surveys.Db
{
[Key]
public int Id { get; set; }
[StringLength(100)]
[Required]
public string Title { get; set; }
//[StringLength(1000)]
//public string Description { get; set; }
public bool IsEnabled { get; set; }
public DateTime? StartDate { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime EndDate { get; set; }
//public DateTime CreatedDate { get; set; }
//[StringLength(6)]
//public string EmployeeID { get; set; }
public DateTime CreatedDate { get; set; } = DateTime.Now;
/*
[StringLength(10)]
[ForeignKey("Employee")]
public string EmployeeId { get; set; }
*/
}
}

View File

@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace DamageAssesment.Api.Surveys.Db
{
public class SurveyTranslation
{
[Key]
public int Id { get; set; }
[ForeignKey("Survey")]
public int SurveyId { get; set; }
[StringLength(200)]
[Required]
public string Title { get; set; }
public string Language { get; set; }
}
}

View File

@ -2,19 +2,32 @@
namespace DamageAssesment.Api.Surveys.Db
{
public class SurveysDbContext:DbContext
public class SurveysDbContext : DbContext
{
private IConfiguration _Configuration { get; set; }
public SurveysDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
{
_Configuration = configuration;
}
public DbSet<Db.Survey> Surveys { get; set; }
public DbSet<Db.SurveyTranslation> SurveysTranslation { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
// connect to sql server with connection string from app settings
options.UseSqlServer(_Configuration.GetConnectionString("SurveyConnection"));
}
public DbSet<Db.Survey> Surveys { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Survey>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<SurveyTranslation>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
}
}
}