/// <inheritdoc/> public async Task <ServiceExecuteResult <IEnumerable <News> > > GetAllNews() { try { var news = await _repository.GetNews(includeDescriptions : false); return(new ServiceExecuteResult <IEnumerable <News> > { IsSuccess = true, Result = news.OrderByDescending(x => x.Date) .ToList() }); } catch (Exception ex) { var msg = $"Не получилось получить полный список новостей по след. причине: {ex.Message}"; _logger.LogError(ex, msg); return(new ServiceExecuteResult <IEnumerable <News> > { IsSuccess = false, Error = msg, }); } }
public async Task <IActionResult> GetAllNews() { var news = await _repository.GetNews(includeDescriptions : true); return(Success(news.OrderByDescending(x => x.Date))); }