public JsonResult createpin(string patientloginid, string surgerydate, string PIN) { try { string _result = IPatient.CreatePIN(patientloginid, surgerydate, PIN); if (_result == "success") { User pUser = lIUserRepository.getUser(patientloginid); if (pUser != null) { pUser.Password = PIN; lIUserRepository.UpdateUser(pUser); } return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", TimeZone = DateTime.UtcNow.ToString("s") })); } else if (_result == "fail") { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "No such patient record", TimeZone = DateTime.UtcNow.ToString("s") })); } else { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = DateTime.UtcNow.ToString("s") })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "failed", TimeZone = DateTime.UtcNow.ToString("s") })); } }