Пример #1
0
        protected override void Seed(MedicalReminderDbContext context)
        {
            Doctor doc = new Doctor()
            {
                Id             = Guid.Parse(Resource.DoctorId1),
                FirstName      = "zzz",
                LastName       = "cccc",
                Hospital       = "Arcadia",
                Specialization = "Ceva"
            };
            Drug drug = new Drug()
            {
                Id             = Guid.Parse(Resource.DrugId1),
                Name           = "Aspenter",
                ExpirationDate = DateTime.Parse("Dec-30-2020"),
                Weight         = 23.6
            };

            Drug drug2 = new Drug()
            {
                Id             = Guid.Parse(Resource.DrugId2),
                Name           = "asasa",
                ExpirationDate = DateTime.Parse("Dec-30-2000"),
                Weight         = 2.6
            };
            Prescription prescription = new Prescription()
            {
                Id       = Guid.Parse(Resource.PrescriptionId1),
                DoctorId = doc.Id,
                Doctor   = doc,
                Drugs    = new List <Drug>()
                {
                    drug, drug2
                },
                DateOfPresproption = DateTime.Parse("Dec-30-2020")
            };

            User user = new User()
            {
                Id            = Guid.Parse(Resource.UserId1),
                FirstName     = "aaa",
                LastName      = "bbb",
                Email         = "*****@*****.**",
                UserName      = "******",
                DateOfBirth   = DateTime.Parse("Jan-22-1983"),
                Prescriptions = new List <Prescription>()
                {
                    prescription
                }
            };

            context.Doctors.AddOrUpdate(id => id.Id, doc);
            context.Drugs.AddOrUpdate(id => id.Id, drug);
            context.Prescriptions.AddOrUpdate(id => id.Id, prescription);
            context.Users.AddOrUpdate(id => id.Id, user);
        }
Пример #2
0
 public GenericRepository(MedicalReminderDbContext _context)
 {
     this._context = _context;
     table         = _context.Set <T>();
 }