Exemple #1
0
        ///This is where you can press buttons to move around the video.
        ///Tested basics
        public VideoView GetView(int contentId)
        {
            var video = context.Videos
                        .Include(x => x.Notes)
                        .SingleOrDefault(x => x.Id == contentId);

            if (video == null)
            {
                throw new ItemNotFound("Video you are trying to view does not exist in the database!");
            }

            trackableService.RegisterViewing(video, DateTime.UtcNow, true);

            var contentView = Mapper.Instance.Map <VideoView>(video);

            return(contentView);
        }
Exemple #2
0
        //Authorizes
        //Registers View
        public ListToDoUse GetUseModel(int id, string username)
        {
            var model = context.ListsTodo
                        .Include(x => x.Items)
                        .SingleOrDefault(x => x.Id == id);

            var userId = userService.GetUserId(username);

            if (userId != model.UserId)
            {
                throw new AccessDenied("The list you are trying to access dos not belong to you!");
            }

            trackableService.RegisterViewing(model, DateTime.Now, true);

            var returnModel = Mapper.Instance.Map <ListToDoUse>(model);

            return(returnModel);
        }