public string Delete(int id, Profile userInfo)
        {
            Vault original = _repo.GetById(id);

            if (userInfo.Id == original.CreatorId)
            {
                if (_repo.Delete(id))
                {
                    return("This has been deleted!");
                }
                return("Can't delete");
            }
            else
            {
                return("Access not granted!");
            }
        }
Exemple #2
0
        public string Delete(int id, string userId)
        {
            Vault vault = _repo.GetOne(id);

            if (vault == null)
            {
                throw new Exception("Vault not found");
            }
            if (vault.creatorId != userId)
            {
                throw new Exception("Unauthorized Action");
            }
            if (_repo.Delete(id))
            {
                return("Deleted Vault");
            }
            return("Delete Unsuccessful");
        }