internal string DeleteVaultKeep(int id, Profile userInfo)
        {
            VaultKeep toDelete = _repo.GetKeepById(id);

            if (toDelete == null)
            {
                throw new Exception("No Vault Keep with that ID");
            }
            else if (toDelete.CreatorId != userInfo.Id)
            {
                throw new Exception("You do not own this Vault keep, cannot delete");
            }
            else if (_repo.DeleteVaultKeep(id))
            {
                return("Deleted");
            }
            else
            {
                return("Error");
            }
        }
Exemple #2
0
 public void Delete(int id)
 {
     db.DeleteVaultKeep(id);
 }
Exemple #3
0
 public VaultKeep DeleteVaultKeep(VaultKeep oldVaultKeep)
 {
     return(_repo.DeleteVaultKeep(oldVaultKeep));
 }
Exemple #4
0
 [HttpPut] //NOTE "Can Delete Vault Keep"
 public ActionResult <VaultKeep> Delete([FromBody] VaultKeep vaultKeep)
 {
     vaultKeep.UserId = HttpContext.User.FindFirstValue("Id");
     return(Ok(_repo.DeleteVaultKeep(vaultKeep)));
 }
Exemple #5
0
 public bool DeleteVaultKeep(int id)
 {
     return(_db.DeleteVaultKeep(id));
 }