Exemplo n.º 1
0
        internal Keep GetKeepById(int id)
        {
            var exists = _repo.GetKeepById(id);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            return(exists);
        }
Exemplo n.º 2
0
        internal Keep GetKeepById(int Id, string UserId)
        {
            Keep exists = _repo.GetKeepById(Id);

            if (exists == null)
            {
                throw new Exception("Invalid ID");
            }
            if (exists.IsPrivate == true && exists.UserId != UserId)
            {
                throw new Exception("Unauthorized");
            }
            // NOTE Increases view count after keep is successfully retrieved
            _repo.UpKeepViews(exists);
            exists.Views += 1;
            return(exists);
        }
Exemplo n.º 3
0
        internal Keep GetKeepById(int id)
        {
            Keep foundKeep = _repo.GetKeepById(id);

            if (foundKeep == null)
            {
                throw new Exception("Invalid Keep Id");
            }
            return(foundKeep);
        }