public ActionResult CreatePatient(PatientViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             model.UserId = 1;
             var result = _patientHandler.AddPatient(model);
             PersonId.Id = result.PersonId;
             return(RedirectToAction(nameof(Index)));
         }
         catch
         {
             return(View());
         }
     }
     else
     {
         ModelState.AddModelError("Error", "Please enter all the required fields");
         return(View(model));
     }
 }
Example #2
0
        public async Task <ActionResult> Create(PatientPayloadViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var result = await _patientHandler.AddPatient(model);

                    return(RedirectToAction(nameof(Create)));
                }
                catch
                {
                    return(View());
                }
            }
            else
            {
                ModelState.AddModelError("Error", "Please enter all the required fields");
                return(View(model));
            }
        }
Example #3
0
 public bool AddPatient([FromBody] dynamic model)
 {
     return(_impl.AddPatient((string)model.authenticationCookie, model.info.ToObject <PatientInfo_Json>(), (string)model.userData));
 }