コード例 #1
0
ファイル: KeepsService.cs プロジェクト: SpencerLeBard/Keepr
        internal object Delete(int id, string creatorId)
        {
            Keep original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid Id");
            }
            // if (original.CreatorId != creatorId) { throw new Exception("Access Denied... This is not yours"); }
            _repo.Remove(id);
            return("succesfully delorted");
        }
コード例 #2
0
        internal object Delete(int id, string userId)
        {
            Keep original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid Id");
            }
            if (original.CreatorId != userId)
            {
                throw new Exception("You cannot delete that which is not yours");
            }
            _repo.Remove(id);
            return(original);
        }
コード例 #3
0
ファイル: KeepsService.cs プロジェクト: JustinBarnard1/keepr
        internal object Delete(int keepId, string userId)
        {
            ViewModelKeep original = _repo.GetById(keepId);

            if (original == null)
            {
                throw new Exception("Invalid Id");
            }
            if (original.CreatorId != userId)
            {
                throw new Exception("Access Denied. This is not yours");
            }
            _repo.Remove(keepId);
            return("Succesfully Delorted");
        }