示例#1
0
        public async Task SeedAsync(DataSeedContext context)
        {
            if (!(await _doctorSpecialtyRepository.GetCountAsync() > 0))
            {
                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "جلدية" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "اسنان" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "نفسي" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "اطفال" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "مخ-واعصاب" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "عظام-والطب-الرياضى" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "نساء-وولادة" }, autoSave : true);

                await _doctorSpecialtyRepository.InsertAsync(new DoctorSpecialty { Name = "انف-واذن-وحنجرة" }, autoSave : true);
            }

            if (!(await _doctorTitleRepository.GetCountAsync() > 0))
            {
                await _doctorTitleRepository.InsertAsync(new DoctorTitle { Name = "أستاذ" }, autoSave : true);

                await _doctorTitleRepository.InsertAsync(new DoctorTitle { Name = "أخصائي اول" }, autoSave : true);

                await _doctorTitleRepository.InsertAsync(new DoctorTitle { Name = "استشاري" }, autoSave : true);

                await _doctorTitleRepository.InsertAsync(new DoctorTitle { Name = "أخصائي" }, autoSave : true);
            }

            await _patientRepository.InsertAsync(
                await _patientManager.CreateAsync(
                    1,
                    "George Orwell",
                    DateTime.Now,
                    "Orwell produced literary criticism and poetry, "
                    )
                );

            await _patientRepository.InsertAsync(
                await _patientManager.CreateAsync(
                    1,
                    "Douglas Adams",
                    new DateTime(1952, 03, 11),
                    "Douglas Adams was an English author, screenwriter"
                    )
                );
        }
示例#2
0
        public async Task <PatientDto> CreateAsync(CreatePatientDto input)
        {
            var patient = await _patientManager.CreateAsync(input.DoctorId, input.Name, input.BirthDate, input.ShortDescription);

            await _patientRepository.InsertAsync(patient);

            return(ObjectMapper.Map <Patient, PatientDto>(patient));
        }
示例#3
0
        public async Task <ActionResult> CreateAsync(Patient item)
        {
            if (ModelState.IsValid)
            {
                Patient newpatient = await patientManager.CreateAsync(item);

                return(new OkObjectResult(newpatient));
            }
            else
            {
                return(BadRequest());
            }
        }
示例#4
0
        private void FillInitialData()
        {
            DoctorManager  doctorManager;
            PatientManager patientManager;
            var            list = _doctorContext.GetItemsAsync(y => y.Name != "").Result.ToList();

            if (list.Count < 3)
            {
                doctorManager = new DoctorManager(_doctorContext);
                var x = doctorManager.CreateAsync(new Doctor()
                {
                    Name       = "Mikael Seström",
                    Email      = "*****@*****.**",
                    ItemId     = "201012-1425",
                    Speciality = new Speciality()
                    {
                        Id   = "3",
                        Name = "Clinical radiology"
                    },
                    Description = ""
                });

                x = doctorManager.CreateAsync(new Doctor()
                {
                    Name       = "Carina Axel",
                    Email      = "*****@*****.**",
                    ItemId     = "200911-1758",
                    Speciality = new Speciality()
                    {
                        Id   = "2",
                        Name = "Anaesthesia"
                    },
                    Description = ""
                });

                x = doctorManager.CreateAsync(new Doctor()
                {
                    Name       = "Martin Eriksson",
                    Email      = "*****@*****.**",
                    ItemId     = "199005-1875",
                    Speciality = new Speciality()
                    {
                        Id   = "1",
                        Name = "Clinical oncology"
                    },
                    Description = ""
                });
            }

            var list2 = _patientContext.GetItemsAsync(y => y.Name != "").Result.ToList();

            if (list2.Count < 3)
            {
                patientManager = new PatientManager(_patientContext);
                var x = patientManager.CreateAsync(new Patient()
                {
                    Name    = "Henrik Karlsson",
                    Email   = "*****@*****.**",
                    ItemId  = "19860813-1111",
                    Address = new Address()
                    {
                        ItemId  = "111",
                        ZipCode = "121211"
                    },
                    Description = ""
                });

                x = patientManager.CreateAsync(new Patient()
                {
                    Name    = "Erik Henriksson",
                    Email   = "*****@*****.**",
                    ItemId  = "19750612-2222",
                    Address = new Address()
                    {
                        ItemId  = "112",
                        ZipCode = "121211"
                    },
                    Description = ""
                });

                x = patientManager.CreateAsync(new Patient()
                {
                    Name    = "Cecilia Eliasson",
                    Email   = "*****@*****.**",
                    ItemId  = "19600519-3333",
                    Address = new Address()
                    {
                        ItemId  = "113",
                        ZipCode = "122122"
                    },
                    Description = ""
                });
            }
        }