public async Task <IActionResult> IndexPost(int id, [FromBody] ClientMotherModel motherRequest) { if (motherRequest == null) { return(BadRequest()); } try { motherRequest.AppointmentDate = DateTime.Now; } catch { } motherRequest.IsCompleted = false; var profile = await _scanCenterProfileQuery.GetById(id); if (profile != null) { motherRequest.Id = await _clientMotherQuery.CreateMotherProfile(profile.Id, motherRequest); string baseUrl = $"{Request.Scheme}://{Request.Host}"; _emailManager.SMTPSettings = _appSettings.SMTPSettings; string referid = await _cryptography.Encrypt(motherRequest.Id.ToString(), _appSettings); _emailManager.SendAppointmentDetails(motherRequest, profile, referid, baseUrl, true); _emailManager.SendNotification(motherRequest, profile, baseUrl); return(Ok(new { id = motherRequest.Id })); } return(BadRequest()); }