public async Task <IActionResult> UpdateAppointment(int id, [FromBody] ClientMotherModel motherRequest) { if (motherRequest == null) { return(BadRequest()); } try { motherRequest.AppointmentDate = Utilities.Utilities.ConvertStringToDateTime(motherRequest.Date, motherRequest.Time); } catch { } motherRequest.IsCompleted = true; var profile = await _scanCenterProfileQuery.GetById(id); if (profile != null) { await _scanCenterAppointmentQuery.UpdateAppointment(motherRequest); _emailManager.SMTPSettings = _appSettings.SMTPSettings; string referid = await _cryptography.Encrypt(motherRequest.Id.ToString(), _appSettings); return(Ok(new { id = motherRequest.Id })); } return(BadRequest()); }
public async Task <IActionResult> UpdateAppointment(int id, [FromBody] ClientMotherModel motherRequest) { if (motherRequest == null) { return(BadRequest()); } var profile = await _scanCenterProfileQuery.GetById(motherRequest.ScanCenterProfileId); var appointment = await _scanCenterAppointmentQuery.GetById(motherRequest.Id); appointment.FirstName = motherRequest.FirstName; appointment.LastName = motherRequest.LastName; appointment.Email = motherRequest.Email; appointment.Phone = motherRequest.Phone; appointment.Purpose = motherRequest.Purpose; appointment.InsuranceNumber = motherRequest.InsuranceNumber; appointment.InsuranceCompany = motherRequest.InsuranceCompany; appointment.InsuranceGroup = motherRequest.InsuranceGroup; appointment.SelectedProducts = motherRequest.SelectedProducts; appointment.AppointmentDate = DateTime.Now; appointment.OtherDetails = motherRequest.OtherDetails; appointment.DueDate = motherRequest.DueDate; appointment.DOB = motherRequest.DOB; appointment.IsInsuranceRequired = motherRequest.IsInsuranceRequired; appointment.IsBreastPumpNeeded = motherRequest.IsBreastPumpNeeded; appointment.Address = motherRequest.Address; appointment.Address2 = motherRequest.Address2; appointment.Apt = motherRequest.Apt; appointment.City = motherRequest.City; appointment.State = motherRequest.State; appointment.Zip = motherRequest.Zip; appointment.DoctorName = motherRequest.DoctorName; appointment.DoctorPhone = motherRequest.DoctorPhone; if (!await CheckAuth(motherRequest.ScanCenterProfileId)) { return(BadRequest()); } if (profile != null) { await _scanCenterAppointmentQuery.UpdateAppointment(appointment); _emailManager.SMTPSettings = _appSettings.SMTPSettings; string referid = await _cryptography.Encrypt(appointment.Id.ToString(), _appSettings); return(Ok(new { success = "success" })); } return(BadRequest()); }