Esempio n. 1
0
        private void FillInitialData()
        {
            AppointmentManager appointmentManager = new AppointmentManager(_appointmentContext);
            var list = appointmentManager.GetAllItemsAsync().Result;

            if (list.Count < 3)
            {
                var x = appointmentManager.CreateAsync(new Appointment()
                {
                    PatientId           = "19860813-1111",
                    DoctorId            = "201012-1425",
                    AppointmentDate     = DateTime.UtcNow.AddDays(1).Date,
                    AppointmentTimeSlot = 1
                }).Result;

                x = appointmentManager.CreateAsync(new Appointment()
                {
                    PatientId           = "19750612-2222",
                    DoctorId            = "201012-1425",
                    AppointmentDate     = DateTime.UtcNow.AddDays(1).Date,
                    AppointmentTimeSlot = 3
                }).Result;

                x = appointmentManager.CreateAsync(new Appointment()
                {
                    PatientId           = "19860813-1111",
                    DoctorId            = "201012-1425",
                    AppointmentDate     = DateTime.UtcNow.AddDays(1).Date,
                    AppointmentTimeSlot = 1
                }).Result;
            }
        }
Esempio n. 2
0
        //[ValidateAntiForgeryToken]
        public async Task <ActionResult> CreateAsync(Appointment item)
        {
            if (ModelState.IsValid)
            {
                Appointment newdoctor = await appointmentsManager.CreateAsync(item);

                return(new OkObjectResult(newdoctor));
            }
            else
            {
                return(BadRequest());
            }
        }