Beispiel #1
0
        public IActionResult CreateAppointmentRequest(AppointmentCreateInputModel input)
        {
            var appointment = new Appointment()
            {
                CustomerId    = input.CustomerId,
                OfferId       = input.OfferId,
                Date          = input.Date,
                IsConfirmed   = false,
                DateRequested = DateTime.Now
            };

            _repository.Add(appointment);
            _repository.SaveChanges();

            return(Ok(appointment.Id));
        }
Beispiel #2
0
        public async Task <IActionResult> SubmitVisit(CreateVisitViewModel model)
        {
            var userName = _userManager.GetUserName(User);
            var doctor   = await _doctorsRepository.GetByName(model.Doctor);

            var patient = await _patientsRepository.GetByName(userName);

            var appointment = new Appointment
            {
                StartDateTime = DateTime.Now,
                Doctor        = doctor,
                Patient       = patient,
                Status        = Status.New,
                Description   = model.Description
            };

            await _appointmentsRepository.Add(appointment);

            return(RedirectToAction("Index", "Home"));
        }