public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; var clinics = new List <SelectListItem>(); clinics = _clinicRepository.GetAll() .Select(a => new SelectListItem { Text = a.Name, Value = a.Id.ToString() } ).ToList(); model.Clinics = clinics; if (ModelState.IsValid) { var clinic = _clinicRepository.Get(model.ClinicId); var user = new User { UserName = model.Email, Email = model.Email, EmailConfirmed = false, ClinicId = model.ClinicId, Clinic = clinic }; var errors = await _doctorRepository.Add(user, model.Password); if (errors == null) { _logger.LogInformation("Doctor added"); return(RedirectToLocal(returnUrl)); } else { AddErrors(errors); } } return(View(model)); }
public async Task <ApiResult <Clinic> > GetAsync(int Id) { _logger.LogInformation(_localizer["LogMethodCalled", "api/Clinic/Get"]); ApiResult <Clinic> response = await _clinicRepository.Get(Id); _logger.LogInformation(_localizer["LogMethodResult", "api/Clinic/Get", response.Deserialize()]); return(response); }
// GET: Clinics/Details/5 public ActionResult Details(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var clinic = repository.Get(id); if (clinic == null) { return(HttpNotFound()); } return(View(clinic)); } catch (Exception ex) { //If an exception is thrown, log the error and return null. log.Error(string.Format("An error had been encountered getting the clinic details {0}, Exception Message {1}", id, ex)); return(null); } }
// GET: ClinicController/Details/5 public ActionResult Details(string id) { var details = _repository.Get(id); return(View(details)); }