public async Task<IHttpActionResult> GetCowsTotal() { var result = new ServiceProcessingResult<List<Cow>>(); var cowService = new CowDataService(); var cowResult = await cowService.getActiveCows(LoggedInUser.ClientID); if (!cowResult.IsSuccessful) { result.Error = new ProcessingError("An error occurred while getting total cows.","Could not retrieve total cows, please try again. If the problem persists contact support.", true); result.IsSuccessful = false; return Ok(result); } result.IsSuccessful = true; result.Data = cowResult.Data; return Ok(result); }
public async Task<IHttpActionResult> GetActiveCows() { var cowService = new CowDataService(); try { var processingResult = await cowService.getActiveCows(LoggedInUser.ClientID); if (!processingResult.IsSuccessful) { processingResult.Error = new ProcessingError("An error occurred while getting all available Cows.", "Could not retrieve Cows, please try again. If the problem persists contact support.", true); return Ok(processingResult); } processingResult.Data = processingResult.Data.OrderBy(c => c.TagNumber).ToList(); return Ok(processingResult); } catch (Exception ex) { var processingResult = new ServiceProcessingResult(); ExceptionlessClient.Default.ProcessQueue(); ex.ToExceptionless().Submit(); return Ok(processingResult); } }