Exemplo n.º 1
0
        public ActionResult GetEmployeeMenu()
        {
            var _menu = new MenuViewModel();
            AnnouncementInfo _announcement = null;
            AlbumInfo        _album        = null;

            using (AnnouncementRepository Repo = new AnnouncementRepository())
            {
                _announcement = Repo.GetRecentAnnouncement();
            }

            using (AlbumRepository Repo = new AlbumRepository())
            {
                _album = Repo.GetRecentAlbum();
            }

            if (_announcement != null)
            {
                TimeSpan tSpan = (DateTime.Parse(_announcement.CreatedOn.Value.ToString()).AddDays(1)).Subtract(DateTime.Now);

                double diff = tSpan.TotalDays;

                if (diff > 0)
                {
                    _menu.IsNewAnnouncement = true;
                }
            }

            if (_album != null)
            {
                TimeSpan tSpan = (DateTime.Parse(_album.CreatedOn.Value.ToString()).AddDays(1)).Subtract(DateTime.Now);

                double diff = tSpan.TotalDays;

                if (diff > 0)
                {
                    _menu.IsNewAlbum = true;
                }
            }

            return(PartialView("_EmployeeMenu", _menu));
        }