public News Get(int id) { NewsMapper newsMapper = new NewsMapper(); News news = newsMapper.Get(id); if (news == null) { string errorDescription = "No se ha encontrado la noticia con id " + id + "."; log.AddLogCritical("Get", errorDescription, this); AddError(new ResultBE(ResultBE.Type.NULL, errorDescription)); } return(news); }
/// <summary> /// Devuelve el listado de novedades de la base. /// </summary> /// <returns></returns> public List <News> Get() { NewsMapper newsMapper = new NewsMapper(); List <News> newsList = newsMapper.Get(); CategoryManager newscategoryManager = new CategoryManager(); Dictionary <int, Category> newsCategories = newscategoryManager.GetDictinoray(); foreach (News news in newsList) { news.Category = newsCategories[news.Category.Id]; } return(newsList); }