Пример #1
0
        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.DeleteVaultKeep(id);
            return("deleted");
        }
Пример #2
0
 internal VaultKeep DeleteVaultKeep(VaultKeep toRemove)
 {
   VaultKeep found = _repo.Get(toRemove);
   if (found.UserId != toRemove.UserId)
   {
     throw new UnauthorizedAccessException("Invalid Request");
   }
   if (_repo.DeleteVaultKeep(toRemove))
   {
     return found;
   }
   throw new Exception("Invalid data");
 }
Пример #3
0
        internal object DeleteVaultKeep(int id, string userId)
        {
            VaultKeep data = _repo.GetById(id);

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

            if (data.CreatorId != userId)
            {
                throw new Exception("Access Denied NOT YOURS... from vaultkeepsService");
            }
            _repo.DeleteVaultKeep(id);
            return("Successfully deleted... from vaultkeepsService");
        }