Beispiel #1
0
        public ActionResult Edit(Guid id)
        {
            try
            {
                var group         = _screenGroupRepository.GetById(id);
                var videos        = _mediaRepository.ListByUser(GetCurrentUser().User.ToString()).Where(p => p.GetType() == typeof(Movie));
                var presentations = _mediaRepository.ListByUser(GetCurrentUser().User.ToString()).Where(p => p.GetType() == typeof(Presentation));

                var model = new GroupViewModel()
                {
                    Id                    = group.Id,
                    Title                 = group.Title,
                    Videos                = videos,
                    SelectedVideos        = group.Media.Where(v => v.GetType() == typeof(Movie)),
                    Presentations         = presentations,
                    SelectedPresentations = group.Media.Where(p => p.GetType() == typeof(Presentation))
                };

                return(View(model));
            }
            catch (Exception e)
            {
                Request.Flash("error", Resources.Resources.SevereError + ": " + e.Message);

                return(RedirectToAction("Index"));
            }
        }
Beispiel #2
0
        public void GetGroupById()
        {
            var rep  = new ScreenGroupRepository();
            var item = rep.GetById(new Guid("A42088BB-E82B-4E7A-A214-4C0C472E2910"));

            item.Should().NotBeNull();
        }
Beispiel #3
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var group  = _screenGroupRepository.GetById(new Guid(collection["GroupId"]));
                var screen = Screen.Create(collection["Title"], collection["Location"], group);
                screen.CreatedBy   = GetCurrentUser().User.ToString();
                screen.ModifiedBy  = screen.CreatedBy;
                screen.HostName    = collection["HostName"];
                screen.RefreshTime = new RefreshTime(Convert.ToInt32(collection["RefreshHours"]), Convert.ToInt32(collection["RefreshMinutes"]), Convert.ToInt32(collection["RefreshSeconds"]));

                _screenRepository.Insert(screen);

                Request.Flash("success", Resources.Resources.Screen + " " + Resources.Resources.Saved);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Request.Flash("error", Resources.Resources.SevereError + ": " + e.Message);

                return(RedirectToAction("Index"));
            }
        }
        public IHttpActionResult GetList(Guid groupId)
        {
            var group         = _groupRepository.GetById(groupId);
            var items         = _mediaRepository.ListByGroup(group).Where(x => x.GetType().Name == "Presentation" || x.GetType().Name == "Movie");
            var presentations = new List <PresentationModel>();

            foreach (var item in items)
            {
                presentations.Add(new PresentationModel()
                {
                    Id  = item.Id,
                    Url = item.Url
                });
            }

            return(Ok(presentations));
        }
Beispiel #5
0
        public IHttpActionResult GetList(Guid groupId)
        {
            var group         = _groupRepository.GetById(groupId);
            var dateNow       = DateTime.Now;
            var items         = _notificationRepository.ListByGroup(group).Where(x => x.PublishUp <= dateNow && x.PublishDown >= dateNow);
            var notifications = new List <NotificationViewModel>();

            foreach (var item in items)
            {
                notifications.Add(new NotificationViewModel()
                {
                    Id          = item.Id,
                    Title       = item.Title,
                    PublishUp   = item.PublishUp,
                    PublishDown = item.PublishDown
                });
            }

            return(Ok(notifications));
        }