public ActionResult UpdatePatient(int id) { ViewBag.patientId = id; //Get specific patient based on the selected patient id var objPatient = objPat.getPatientByID(id); if (objPatient == null) { return(View("NotFound")); } else { UpdatePatientModel objUpPat = new UpdatePatientModel(); objUpPat.health_card = objPatient.health_card; objUpPat.first_name = objPatient.first_name; objUpPat.last_name = objPatient.last_name; objUpPat.birth_date = objPatient.birth_date; objUpPat.gender = objPatient.gender; objUpPat.email = objPatient.email; objUpPat.phone = objPatient.phone; objUpPat.address = objPatient.address; objUpPat.city = objPatient.city; objUpPat.province = objPatient.province; objUpPat.postal_code = objPatient.postal_code; return(View(objUpPat)); } }
public ActionResult UpdatePatient(int id, UpdatePatientModel model) { ViewBag.patientId = id; if (ModelState.IsValid) { try { riversideLinqDataContext objLinq = new riversideLinqDataContext(); patient objPatient = objLinq.patients.Single(x => x.id == id); objPatient.health_card = model.health_card; objPatient.first_name = model.first_name; objPatient.last_name = model.last_name; objPatient.birth_date = model.birth_date; objPatient.gender = model.gender; objPatient.email = model.email; objPatient.phone = model.phone; objPatient.address = model.address; objPatient.city = model.city; objPatient.province = model.province; objPatient.postal_code = model.postal_code; objLinq.SubmitChanges(); //return RedirectToAction("PatientDetail/" + id); return(RedirectToAction("ListPatient")); } catch { return(View(model)); } } return(View(model)); }
public async Task <IActionResult> UpdatePatient(string patientId, [FromBody] UpdatePatientModel model) { var user = await _userManager.FindByIdAsync(patientId); if (user == null) { return(BadRequest()); } user.City = model.City; user.Gender = model.Gender; user.FullName = model.FullName; user.FirstRelativeName = model.FirstRelativeName; user.FirstRelativePhoneNumber = model.FirstRelativePhoneNumber; user.SecondRelativeName = model.SecondRelativeName; user.PasswordHash = model.Password; user.SecondRelativePhoneNumber = model.SecondRelativePhoneNumber; user.PhoneNumber = model.PhoneNumber; await _userManager.UpdateAsync(user); return(Ok()); }
public ActionResult EditDetails(PatientModel model) { try { var dataurl = Request["image-data"]; dataurl = dataurl.Replace("data:image/png;base64,", ""); byte[] data = Convert.FromBase64String(dataurl); var fileName = Request["image-name"]; var input = new UpdatePatientModel { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, PatientId = model.PatientId, Phone = model.Phone, }; if (data.Length > 0) { input.FileName = fileName; input.Image = data; } _patientService.UpdatePatient(input); return(RedirectToAction("PatientDetails", new { model.PatientId })); } catch (Exception) { return(View(model)); } }
public ActionResult UpdatePatient(int id, UpdatePatientModel model) { if (ModelState.IsValid) { try { riversideLinqDataContext objLinq = new riversideLinqDataContext(); patient objPatient = objLinq.patients.Single(x => x.id == id); objPatient.health_card = model.health_card; objPatient.first_name = model.first_name; objPatient.last_name = model.last_name; objPatient.birth_date = model.birth_date; objPatient.gender = model.gender; objPatient.email = model.email; objPatient.phone = model.phone; objPatient.address = model.address; objPatient.city = model.city; objPatient.province = model.province; objPatient.postal_code = model.postal_code; objLinq.SubmitChanges(); return(RedirectToAction("PatientProfile")); } catch { return(View(model)); } } // If we got this far, something failed, redisplay form return(View(model)); }
public UpdatePatientViewModel(AdminShellViewModel containingVm, Patient patientToUpdate) { updatePatientM = new UpdatePatientModel(); this.containingVm = containingVm; Patient = patientToUpdate; UpdateDbCommand = new UpdateInDbCommand(this); IsNewPatient = false; BackCommand = new BackCommand(this); }
public async Task <IActionResult> UpdatePatient(string PatientId, [FromBody] UpdatePatientModel model) { var user = await this.usermanager.FindByIdAsync(PatientId); if (user == null) { return(BadRequest()); } user.City = model.City; user.RelativeOneName = model.RelativeOneName; user.RelativeOnePhoneNumber = model.RelativeOnePhoneNumber; user.RelativeTwoName = model.RelativeTwoName; user.RelativeTwoPhoneNumber = model.RelativeTwoPhoneNumber; user.PhoneNumber = model.PhoneNumber; await this.usermanager.UpdateAsync(user); return(Ok()); }
public IActionResult UpdatePatient(string id, [FromBody] UpdatePatientModel model) { model.Id = new Guid(id); _updatePatientCommand.Execute(model); return(Ok()); }
public static JObject PostMultipartFormPatient(string url, ApiHeader apiHeader, UpdatePatientModel model) { return(CallMultipartPatientFormApi(url, apiHeader, model)); }
private static JObject CallMultipartPatientFormApi(string url, ApiHeader apiHeader, UpdatePatientModel data) { var cultureCode = Thread.CurrentThread.CurrentCulture; var clientHandler = new WebRequestHandler(); clientHandler.ClientCertificates.Add(new X509Certificate2()); var httpClient = new HttpClient(); if (apiHeader != null) { httpClient.DefaultRequestHeaders.Add("userId", apiHeader.UserId); httpClient.DefaultRequestHeaders.Add("sessionId", apiHeader.SessionId); } if (!string.IsNullOrEmpty(apiHeader?.Lang)) { httpClient.DefaultRequestHeaders.Add("lang", apiHeader.Lang); } else { httpClient.DefaultRequestHeaders.Add("lang", "en"); } var multipart = new MultipartFormDataContent { { new StringContent(string.IsNullOrEmpty(data.PatientId) ? "" : data.PatientId), "id" }, { new StringContent(string.IsNullOrEmpty(data.FirstName) ? "" : data.FirstName), "firstName" }, { new StringContent(string.IsNullOrEmpty(data.LastName) ? "" : data.LastName), "lastName" }, { new StringContent(string.IsNullOrEmpty(data.Email) ? "" : data.Email), "email" }, { new StringContent(string.IsNullOrEmpty(data.Phone) ? "" : data.Phone), "phone" }, }; if (!string.IsNullOrEmpty(data.FileName)) { multipart.Add(new ByteArrayContent(data.Image), "photo", data.FileName); } var result = httpClient.PostAsync(new Uri(url), multipart).Result; var response = JsonConvert.DeserializeObject <ApiResponse>(result.Content.ReadAsStringAsync().Result); if (!(response.ErrorMessage == "SUCCESS")) { throw new ApiException(response.ErrorMessage, response.ErrorCode.ToString(), cultureCode.Name); } return(response.Result); }
public void UpdatePatient(UpdatePatientModel model) { var url = ApiUrl.Default.RootApi + ApiUrl.Default.UpdatePatient; Restful.PostMultipartFormPatient(url, null, model); }