public ActionResult <string> Delete(int id) { bool successful = _vr.Delete(id); if (!successful) { return(BadRequest()); } return(Ok()); }
public ActionResult <string> Delete(int id) { bool successful = _vr.Delete(id); if (!successful) { return(BadRequest("Cannot Delete")); } return(Ok("successfully deleted")); }
public ActionResult <string> Delete(int id) { try { return(Ok(_repo.Delete(id))); } catch (Exception e) { return(BadRequest(e)); } }
internal Vault Delete(int id, string userId) { Vault original = GetById(id, userId); if (userId != original.CreatorId) { throw new Exception("You can only delete your own data"); } _repo.Delete(id); return(original); }
public string Delete(int id) { string Deleted = "Vault Deleted"; bool deletedVault = _vr.Delete(id); if (deletedVault) { return(Deleted); } ; throw new Exception("Not a valid Vault"); }
public string Delete(int id, string userId) { Vault original = _repo.GetSingleVault(id); if (original == null || original.CreatorId != userId) { throw new Exception("Invalid Request!"); } if (_repo.Delete(id)) { return("Successfully Deleted Vault"); } return("Unsuccessful in Deleting Vault"); }
public string Delete(int id, string userId) { Vault original = _repo.GetOne(id); if (userId != original.CreatorId) { throw new System.Exception("You are not the user : Access Denied"); } if (original.IsPrivate == true) { if (_repo.Delete(id)) { return("Vault deleted"); } return("Not deleted"); } return("Cannot delete public Vault"); }
internal string Delete(int id, string userId) { Vault data = _repo.Find(id); if (data == null) { throw new Exception("Bad Id"); } if (data.CreatorId != userId) { throw new Exception("Not user, Access Denied"); } if (_repo.Delete(id)) { return("deleted succesfully"); } return("did not remove succesfully"); }
[HttpDelete("{id}")]//one Vault public string Delete(int id) { return(_repo.Delete(id)); }