public IActionResult Edit(int id, Director director) { if (ModelState.IsValid) { try { _directorService.Edit(director); } catch (Exception ex) { _logger.LogInformation(LoggerMessageDisplay.DirectorEditErrorModelStateInvalid, ex); throw; } RedirectToAction(nameof(Index)); } return(View(director)); }
public IActionResult EditDirector(int id, Director director) { if (id != director.Id) { return(BadRequest()); } try { _directorService.Edit(director); return(Ok(director)); } catch (Exception ex) { throw new ArgumentException($"Error occured: {ex}."); } }
public void Edit(User entity) { if (entity.GetType() == typeof(Doctor)) { _doctorService.Edit((Doctor)entity); } else if (entity.GetType() == typeof(Patient)) { _patientService.Edit((Patient)entity); } else if (entity.GetType() == typeof(Secretary)) { _secretaryService.Edit((Secretary)entity); } else if (entity.GetType() == typeof(Director)) { _directorService.Edit((Director)entity); } }
public IActionResult Edit(int id, Director director) { if (id != director.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _directorService.Edit(director); } catch (Exception ex) { throw ex; } return(RedirectToAction(nameof(Index))); } return(View(director)); }
public void Edit(Director entity) { _directorService.Edit(entity); }