コード例 #1
0
        //Passes an id to the repository to delete
        internal string Delete(int id, string userId)
        {
            var res = GetById(id);

            if (res.CreatorId != userId)
            {
                throw new System.Exception("Credential mismatch, please confirm you have permission to do this");
            }
            _repo.DeleteKeep(id);
            return("Keep @res.name has been deleted");
        }
コード例 #2
0
        internal object DeleteKeep(int id, string userId)
        {
            Keep original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid Id... from keepsService");
            }

            if (original.CreatorId != userId)
            {
                throw new Exception("Access Denied NOT YOURS... from keepsService");
            }

            _repo.DeleteKeep(id);
            return("Successfully Deleted... from keepsService");
        }