/// <summary> /// Get all of the active announcements to be displayed on the screen. /// </summary> /// <param name="request"></param> /// <returns></returns> public GetActiveAnnouncementsResponse GetActiveAnnouncements(GetActiveAnnouncementsRequest request) { LogService.Instance.Log.Info("GetActiveAnnouncements Service Method Called"); var announcements = _repository.GetAll <AppAnnouncement>() .Where( p => (p.EffectiveDate == null || p.EffectiveDate <= DateTime.Now) && (p.ExpirationDate == null || p.ExpirationDate >= DateTime.Now) && p.Active == true) .OrderByDescending(p => p.ForceToTopOfList) .ThenByDescending(p => p.EffectiveDate) .ThenByDescending(p => p.CreateDate) .ToList(); return(new GetActiveAnnouncementsResponse() { IsSuccessful = true, Message = "Service successfully completed", AppAnnouncements = announcements }); }
/// <summary> /// The main index page /// </summary> /// <returns></returns> public virtual ActionResult Index() { //TODO, remove these lines in an actual implementation. This just causes a divide by zero //error so we can test the custom error page. //var t = 0; //var i = 10/t; //TODO This is just an example of calling a WCF service //Remove me in the implementation of the project //_service.CallSampleWebServiceMethod(); // //Get the announcements to display on the home page // var appAnnouncementsRequest = new GetActiveAnnouncementsRequest() { }; var appAnnouncementsResponse = _appAnnouncementsService.GetActiveAnnouncements(appAnnouncementsRequest); var model = new HomeViewModel(); model.AppAnnouncements = appAnnouncementsResponse.AppAnnouncements; return(View(model)); }