Multi language dynamic object changes

This commit is contained in:
uppuv
2023-09-08 15:40:06 -04:00
parent 24a6e6513e
commit 4cf7d9f891
21 changed files with 370 additions and 283 deletions

View File

@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace DamageAssesment.Api.Questions.Db
{
public class CategoryTranslation
{
[Key]
public int Id { get; set; }
[ForeignKey("QuestionCategory")]
public int CategoryId { get; set; }
public string Title { get; set; }
public string Language { get; set; }
}
}

View File

@ -7,8 +7,8 @@ namespace DamageAssesment.Api.Questions.Db
{
[Key]
public int Id { get; set; }
public string CategoryName { get; set; }
public string CategoryImage { get; set; }
public string IconName { get; set; }
public string IconLibrary { get; set; }
}
}

View File

@ -10,6 +10,7 @@ namespace DamageAssesment.Api.Questions.Db
public DbSet<Db.QuestionType> QuestionTypes { get; set; }
public DbSet<Db.QuestionsTranslation> QuestionsTranslations { get; set; }
public DbSet<Db.QuestionCategory> QuestionCategories { get; set; }
public DbSet<Db.CategoryTranslation> CategoryTranslations { get; set; }
public QuestionDbContext(DbContextOptions options) : base(options)
{
@ -29,6 +30,9 @@ namespace DamageAssesment.Api.Questions.Db
modelBuilder.Entity<QuestionCategory>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<CategoryTranslation>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
}
}
}