public async Task <IActionResult> SetToRole(int id) { var doctor = await this.doctorService.DoctorExists(id); if (!doctor) { return(NotFound()); } var model = new DoctorIdNameModel { Id = id }; return(View(model)); }
public async Task <IActionResult> SetToRole(DoctorIdNameModel model) { var doctor = await this.doctorService .DoctorExists(model.Id); if (!doctor) { return(NotFound()); } var success = await this.doctorService .SetToRoleAsync(model.Id); if (success) { TempData["Message"] = $"This {model.Name} doctor was set in Doctor role"; } if (!success) { TempData["Message"] = $"This {model.Name} doctor has no user!"; } return(RedirectToAction(nameof(All))); }