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)); }
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")); }