public IEnumerable <InspectionViewModel> Get(string objectI) { var inspections = _inspectionRepository.GetAll().Where(x => x.ObjectI.Equals(objectI)).OrderBy(x => x.DisplayLineNo); if (inspections.Any()) { var destination = Mapper.Map <IEnumerable <Inspection_M>, IEnumerable <InspectionViewModel> >(inspections); return(destination); } return(null); }
public async Task <IActionResult> Get() { try { var inspections = await _repository.GetAll(); return(Ok(inspections)); }catch (Exception e) { //Log error Log.Error(e.Message); Log.Error(e.StackTrace); return(BadRequest("An error ocurred, contact IT Staff")); } }