public ActionResult CompanyNewsDetail(int newsid) { var model = new CompanyNewsViewModel(); List <CompanyNewsItem> newsList = Exigo.GetCompanyNewsSQL(new ExigoService.GetCompanyNewsRequest() { NewsDepartments = GlobalSettings.Backoffices.CompanyNews.Departments }); model.CompanyNewsItems = newsList.Where(c => c.NewsID == newsid).ToList(); return(View(model)); }
public ActionResult CompanyNewsList() { var model = new CompanyNewsViewModel(); //Get all the departments that will be used for news var newsDepartments = GlobalSettings.Backoffices.CompanyNews.Departments; if (newsDepartments.Length > 0) // If there are departments one at a time grab all news from each department and pull them in. { model.CompanyNewsItems = Exigo.GetCompanyNewsSQL(new GetCompanyNewsRequest() { NewsDepartments = newsDepartments }); } else // none are configured grab them all by leaving the department blank { model.CompanyNewsItems = Exigo.GetCompanyNewsSQL(new GetCompanyNewsRequest()); } return(View(model)); }
public JsonNetResult GetCompanyNews() { var customerID = Identity.Current.CustomerID; try { var newsRequestResponse = Cache.Get("Dashboard__CompanyNews", TimeSpan.FromMinutes(WidgetCacheTimeout), () => Exigo.GetCompanyNewsSQL(new GetCompanyNewsRequest { NewsDepartments = new List <int> { GlobalSettings.Backoffices.Reports.Dashboard.CompanyNews.Department }.ToArray() }) ); var companyNews = newsRequestResponse.GroupBy(v => v.NewsID).Select(o => o.First()).ToList(); var html = this.RenderPartialViewToString("Cards/CompanyNews", companyNews); return(new JsonNetResult(new { success = true, html })); } catch (Exception ex) { return(new JsonNetResult(new { success = false, message = ex.Message })); } }