Changeset 8e74e2f for FarmatikoData
- Timestamp:
- 11/16/20 03:55:10 (4 years ago)
- Branches:
- master
- Children:
- db484c9
- Parents:
- 8b13eb2
- Location:
- FarmatikoData
- Files:
-
- 7 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoDataContext.cs
r8b13eb2 r8e74e2f 7 7 { 8 8 public FarmatikoDataContext(DbContextOptions options) : base(options) { } 9 9 10 10 11 11 public virtual DbSet<HealthFacility> HealthFacilities { get; set; } … … 18 18 public virtual DbSet<User> Users { get; set; } 19 19 public virtual DbSet<PharmacyHeadMedicine> PharmacyHeadMedicines { get; set; } 20 20 21 21 protected override void OnModelCreating(ModelBuilder modelBuilder) 22 22 { 23 modelBuilder.UseSerialColumns(); 24 23 25 modelBuilder.Entity<PharmacyHead>() 24 26 .ToTable("PharmacyHeads"); … … 29 31 modelBuilder.Entity<Pharmacy>() 30 32 .ToTable("Pharmacies"); 33 34 modelBuilder.Entity<Medicine>() 35 .Property(x => x.Id) 36 .HasIdentityOptions(startValue: 1); 37 38 modelBuilder.Entity<Pharmacy>() 39 .Property(x => x.Id) 40 .HasIdentityOptions(startValue: 1); 41 42 modelBuilder.Entity<PharmacyHead>() 43 .Property(x => x.Id) 44 .HasIdentityOptions(startValue: 1); 45 46 modelBuilder.Entity<PharmacyHeadMedicine>() 47 .Property(x => x.Id) 48 .HasIdentityOptions(startValue: 1); 49 50 modelBuilder.Entity<RequestPharmacyHead>() 51 .Property(x => x.Id) 52 .HasIdentityOptions(startValue: 1); 53 54 modelBuilder.Entity<User>() 55 .Property(x => x.Id) 56 .HasIdentityOptions(startValue: 1); 31 57 32 58 modelBuilder.Entity<PharmacyHeadMedicine>() … … 47 73 .HasForeignKey(k => k.PheadId); 48 74 49 /*50 modelBuilder.Entity<CarDetails>()51 .ToTable("CarDetails");52 75 53 modelBuilder.Entity<CarDetails>()54 .Property(x => x.Type)55 .HasConversion<int>();56 57 modelBuilder.Entity<CarDetails>()58 .HasMany(x => x.ImageUrls)59 .WithOne(y => y.Car)60 .HasForeignKey(y => y.CarId);61 */62 63 /*modelBuilder.Entity<PharmacyHead>()64 .HasMany(x => x.PharmaciesList);*/65 76 66 77 base.OnModelCreating(modelBuilder); -
FarmatikoData/FarmatikoRepo/PHRepo.cs
r8b13eb2 r8e74e2f 50 50 EditedPHead.PHMedicineList = pharmacyHead.PHMedicineList; 51 51 //_context.Entry<PharmacyHead>(Phead).State = EntityState.Detached; 52 Phead = EditedPHead;52 //Phead = EditedPHead; 53 53 await _context.SaveChangesAsync(); 54 54 } -
FarmatikoData/FarmatikoRepo/Repository.cs
r8b13eb2 r8e74e2f 45 45 var Medicines = await _context.Medicines.Select(x => new Medicine 46 46 { 47 Id = x.Id, 47 48 Name = x.Name, 48 49 Strength = x.Strength, … … 268 269 return phmeds; 269 270 } 271 272 public async Task AddUser(User user) 273 { 274 await _context.Users.AddAsync(user); 275 await _context.SaveChangesAsync(); 276 } 270 277 } 271 278 } -
FarmatikoData/FarmatikoRepoInterfaces/IRepository.cs
r8b13eb2 r8e74e2f 45 45 User GetRole(string userName); 46 46 ICollection<PharmacyHeadMedicine> GetPHMedicines(string email); 47 Task AddUser(User user); 47 48 } 48 49 } -
FarmatikoData/Migrations/20201115222819_InitialMigration.Designer.cs
r8b13eb2 r8e74e2f 11 11 { 12 12 [DbContext(typeof(FarmatikoDataContext))] 13 [Migration("2020111 1183247_InitialMigration")]13 [Migration("20201115222819_InitialMigration")] 14 14 partial class InitialMigration 15 15 { … … 18 18 #pragma warning disable 612, 618 19 19 modelBuilder 20 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn)21 .HasAnnotation("ProductVersion", "3.1. 6")20 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) 21 .HasAnnotation("ProductVersion", "3.1.10") 22 22 .HasAnnotation("Relational:MaxIdentifierLength", 63); 23 23 … … 27 27 .ValueGeneratedOnAdd() 28 28 .HasColumnType("integer") 29 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn);29 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 30 30 31 31 b.Property<string>("Address") … … 67 67 .ValueGeneratedOnAdd() 68 68 .HasColumnType("integer") 69 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn);69 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 70 70 71 71 b.Property<string>("Branch") … … 101 101 .ValueGeneratedOnAdd() 102 102 .HasColumnType("integer") 103 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 103 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 104 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 104 105 105 106 b.Property<DateTime>("CreatedOn") … … 149 150 .ValueGeneratedOnAdd() 150 151 .HasColumnType("integer") 151 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn);152 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 152 153 153 154 b.Property<long>("ActiveGlobal") … … 192 193 .ValueGeneratedOnAdd() 193 194 .HasColumnType("integer") 194 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 195 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 196 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 195 197 196 198 b.Property<string>("Address") … … 230 232 .ValueGeneratedOnAdd() 231 233 .HasColumnType("integer") 232 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 234 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 235 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 233 236 234 237 b.Property<DateTime>("CreatedOn") … … 270 273 271 274 b.Property<int>("Id") 272 .HasColumnType("integer"); 275 .HasColumnType("integer") 276 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'"); 273 277 274 278 b.HasKey("PheadId", "MedicineId"); … … 284 288 .ValueGeneratedOnAdd() 285 289 .HasColumnType("integer") 286 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 290 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 291 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 287 292 288 293 b.Property<DateTime>("CreatedOn") … … 312 317 .ValueGeneratedOnAdd() 313 318 .HasColumnType("integer") 314 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 319 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 320 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 315 321 316 322 b.Property<DateTime>("CreatedOn") … … 321 327 322 328 b.Property<string>("Email") 323 .HasColumnType("text"); 324 325 b.Property<string>("Name") 329 .IsRequired() 330 .HasColumnType("text"); 331 332 b.Property<string>("Name") 333 .IsRequired() 326 334 .HasColumnType("text"); 327 335 328 336 b.Property<string>("Password") 337 .IsRequired() 329 338 .HasColumnType("text"); 330 339 -
FarmatikoData/Migrations/20201115222819_InitialMigration.cs
r8b13eb2 r8e74e2f 14 14 { 15 15 Id = table.Column<int>(nullable: false) 16 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),17 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: 16 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 17 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql:"now()"), 18 18 DeletedOn = table.Column<DateTime>(nullable: true), 19 19 Name = table.Column<string>(nullable: false), … … 34 34 { 35 35 Id = table.Column<int>(nullable: false) 36 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),36 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 37 37 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 38 38 DeletedOn = table.Column<DateTime>(nullable: true), … … 56 56 { 57 57 Id = table.Column<int>(nullable: false) 58 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),58 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 59 59 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 60 60 DeletedOn = table.Column<DateTime>(nullable: true), … … 73 73 { 74 74 Id = table.Column<int>(nullable: false) 75 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),75 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 76 76 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 77 77 DeletedOn = table.Column<DateTime>(nullable: true), … … 91 91 { 92 92 Id = table.Column<int>(nullable: false) 93 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),93 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 94 94 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 95 95 DeletedOn = table.Column<DateTime>(nullable: true), … … 115 115 { 116 116 Id = table.Column<int>(nullable: false) 117 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),117 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 118 118 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 119 119 DeletedOn = table.Column<DateTime>(nullable: true), … … 143 143 { 144 144 Id = table.Column<int>(nullable: false) 145 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),146 CreatedOn = table.Column<DateTime>(nullable: false ),145 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 146 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 147 147 DeletedOn = table.Column<DateTime>(nullable: true), 148 148 Name = table.Column<string>(nullable: false), … … 195 195 { 196 196 Id = table.Column<int>(nullable: false) 197 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn),197 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 198 198 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 199 199 DeletedOn = table.Column<DateTime>(nullable: true), -
FarmatikoData/Migrations/FarmatikoDataContextModelSnapshot.cs
r8b13eb2 r8e74e2f 16 16 #pragma warning disable 612, 618 17 17 modelBuilder 18 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn)19 .HasAnnotation("ProductVersion", "3.1. 6")18 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) 19 .HasAnnotation("ProductVersion", "3.1.10") 20 20 .HasAnnotation("Relational:MaxIdentifierLength", 63); 21 21 … … 25 25 .ValueGeneratedOnAdd() 26 26 .HasColumnType("integer") 27 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn);27 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 28 28 29 29 b.Property<string>("Address") … … 65 65 .ValueGeneratedOnAdd() 66 66 .HasColumnType("integer") 67 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn);67 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 68 68 69 69 b.Property<string>("Branch") … … 99 99 .ValueGeneratedOnAdd() 100 100 .HasColumnType("integer") 101 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 101 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 102 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 102 103 103 104 b.Property<DateTime>("CreatedOn") … … 147 148 .ValueGeneratedOnAdd() 148 149 .HasColumnType("integer") 149 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy. IdentityByDefaultColumn);150 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 150 151 151 152 b.Property<long>("ActiveGlobal") … … 190 191 .ValueGeneratedOnAdd() 191 192 .HasColumnType("integer") 192 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 193 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 194 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 193 195 194 196 b.Property<string>("Address") … … 228 230 .ValueGeneratedOnAdd() 229 231 .HasColumnType("integer") 230 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 232 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 233 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 231 234 232 235 b.Property<DateTime>("CreatedOn") … … 268 271 269 272 b.Property<int>("Id") 270 .HasColumnType("integer"); 273 .HasColumnType("integer") 274 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'"); 271 275 272 276 b.HasKey("PheadId", "MedicineId"); … … 282 286 .ValueGeneratedOnAdd() 283 287 .HasColumnType("integer") 284 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 288 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 289 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 285 290 286 291 b.Property<DateTime>("CreatedOn") … … 310 315 .ValueGeneratedOnAdd() 311 316 .HasColumnType("integer") 312 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); 317 .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'") 318 .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); 313 319 314 320 b.Property<DateTime>("CreatedOn") … … 319 325 320 326 b.Property<string>("Email") 321 .HasColumnType("text"); 322 323 b.Property<string>("Name") 327 .IsRequired() 328 .HasColumnType("text"); 329 330 b.Property<string>("Name") 331 .IsRequired() 324 332 .HasColumnType("text"); 325 333 326 334 b.Property<string>("Password") 335 .IsRequired() 327 336 .HasColumnType("text"); 328 337 -
FarmatikoData/Models/PharmacyHead.cs
r8b13eb2 r8e74e2f 22 22 public string Password { get; set; } 23 23 24 25 24 [JsonProperty("PharmacyMedicines")] 26 25 public List<Medicine> MedicineList { get; set; } -
FarmatikoData/Models/User.cs
r8b13eb2 r8e74e2f 2 2 using System; 3 3 using System.Collections.Generic; 4 using System.ComponentModel.DataAnnotations; 4 5 using System.Text; 5 6 … … 13 14 PharmacyHead 14 15 } 16 [Required] 15 17 public string Name { get; set; } 18 [Required] 16 19 public string Email { get; set; } 20 [Required] 17 21 public string Password { get; set; } 18 22 public Role UserRole { get; set; }
Note:
See TracChangeset
for help on using the changeset viewer.