public ActionResult Index(string searchString) { if (!String.IsNullOrEmpty(searchString)) { return(View(_facultyRepository.SearchFaculty(searchString).ToList())); } return(View(_facultyRepository.GetAllFaculties().ToList())); }
public HttpResponseMessage GetAllFaculties() { try { List <FacultyModel> allFaculties = facultyRepository.GetAllFaculties(); return(Request.CreateResponse(HttpStatusCode.OK, allFaculties)); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors)); } }
public IActionResult GetAllFaculties() { try { List <FacultyModel> allFaculties = facultyRepository.GetAllFaculties(); return(Ok(allFaculties)); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(StatusCode(StatusCodes.Status500InternalServerError, errors)); } }
public JsonResult GetAllFaculties() { var faculties = repository.GetAllFaculties(); if (faculties == null) { return(Json(null)); } List <FacultyVM> view = new List <FacultyVM>(); foreach (Faculty item in faculties) { view.Add(new FacultyVM(item)); } return(Json(view)); }
public HttpResponseMessage GetAllFaculties() { try { HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(facultyRepository.GetAllFaculties())) }; return(hrm); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(errors.ToString()) }; return(hr); } }
public IActionResult GetAll() { return(Ok(repository.GetAllFaculties())); }
public async Task <IEnumerable <FacultyResource> > GetAllFaculties() { var faculties = await repository.GetAllFaculties(); return(mapper.Map <IEnumerable <Faculty>, IEnumerable <FacultyResource> >(faculties)); }