public ActionResult DeleteFaculty(int facultyId) { if (facultyId != 0) { string temp = _faculty.GetById(facultyId).Photo; if (temp != null) { System.IO.File.Delete(Server.MapPath(temp)); } _faculty.Delete(facultyId); } return(RedirectToAction("Faculties")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } _facultyService.Delete(_facultyService.GetById(id.Value)); TempData["Status"] = "Xóa thành công!"; return(Redirect("/Admin/Departments")); }
public IActionResult GetById(int id) { try { var entity = _service.GetById(id); return(Ok(_mapper.Map <BL.Faculty, Faculty>(entity))); } catch (Exception ex) { return(BadRequest($"{ex.Message}")); } }
public ActionResult Faculty(int id) { var faculty = _faculty.GetById(id); DisplayFullFaculty fullFaculty = new DisplayFullFaculty { Name = faculty.Name, Description = faculty.Description, Photo = faculty.Photo, Subjects = _subject.GetSubjectsNamesEIE(faculty.FacultySubjects), SpecialtiesDTO = _specialty.GetByFacultyId(id) }; return(View(fullFaculty)); }
// GET api/<controller>/5 public FacultyDTO Get(int id) { return(facultyService.GetById(id)); }
public async Task <IActionResult> GetFacultyById(int id) { var result = await _facultyService.GetById(id); return(Ok(result)); }
public async Task <IActionResult> Get([FromRoute] Guid id) { var result = await facultyService.GetById(id); return(Ok(result)); }