コード例 #1
0
        public ActionResult Index()
        {
            try
            {
                var announcements = announcementsService.GetAll();

                List <Announcement> announcementsList = announcements.ToList();

                announcementsList.Sort((x, y) => DateTime.Compare(y.AddedTime, x.AddedTime));

                announcements = announcementsList;

                return(View(new AnnouncementViewModel {
                    Announcements = announcements
                }));
            }
            catch (Exception)
            {
                return(BadRequest("Invalid request received"));
            }
        }
        public ActionResult Index()
        {
            var model = _service.GetAll();

            return(View(model));
        }