public HttpResponseMessage DeleteFaculty(string deleteByCode) { try { int i = facultyRepository.DeleteFaculty(deleteByCode); if (i > 0) { HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.NoContent) { }; return(hrm); } HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError) { }; return(hr); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(errors.ToString()) }; return(hr); } }
public IActionResult Delete(int id) { _facultyRepository.DeleteFaculty(id); _logger.LogInformation($"Delete faculty with id: {id}!"); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(int?id) { if (!await facultyRepository.DeleteFaculty(id)) { return(NotFound()); } return(RedirectToAction(nameof(Index))); }
public RedirectToActionResult DeleteFaculty(int fid) { FacultyResponse deleteFaculty = repository.DeleteFaculty(fid); if (deleteFaculty != null) { TempData["message"] = $"{deleteFaculty.fName} has been deleted!"; } return(RedirectToAction("ViewFaculty")); }
public HttpResponseMessage DeleteFaculty(string facultyCode) { try { int i = facultyRepository.DeleteFaculty(facultyCode); return(Request.CreateResponse(HttpStatusCode.NoContent)); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors)); } }
public IActionResult DeleteFaculty(string facultyCode) { try { int i = facultyRepository.DeleteFaculty(facultyCode); return(NoContent()); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(StatusCode(StatusCodes.Status500InternalServerError, errors)); } }
public IActionResult DFaculty(Faculty faculty) { fRepository.DeleteFaculty(faculty.FacultyCode); TempData["message"] = $"{faculty.FacultyName} was deleted"; return(RedirectToAction("Faculty")); }
private void DeleteFaculty(string path, int id) { _facRep.DeleteFaculty(id); _fileRep.DeleteFolder(Path.Combine(StoragePath, path, id.ToString())); }
public ActionResult Delete(int Id) { _facultyRepository.DeleteFaculty(Id); return(RedirectToAction("Index")); }