public bool Delete([FromBody] VaultKeep vaultkeep) { if (HttpContext.User.Identity.Name != vaultkeep.UserId) { throw new Exception("Cannot delete other's vaultkeeps!"); } bool deleted = _repo.Delete(vaultkeep); return(deleted); }
public ActionResult <string> Delete(int id) { bool successful = _vkr.Delete(id); if (!successful) { return(BadRequest("No Delete")); } return(Ok()); }
internal string Delete(int id, string userId) { VaultKeep original = GetById(id); if (original.CreatorId != userId) { throw new Exception("You are not the creator, you can not delete this!"); } _repo.Delete(id); return("Deleted"); }
public DTOVaultKeep Delete(int id, string userId) { DTOVaultKeep exists = Get(id); if (exists.UserId != userId) { throw new Exception("This is not your VaultKeep!"); } _repo.Delete(id); return(exists); }
public void Delete([FromBody] VaultKeepDiscard vk) { if (vk.UserId == HttpContext.User.Identity.Name) { _repo.Delete(vk.VaultId, vk.KeepId); } else { throw new Exception("Not authorized to edit another user's vault"); } }
public ActionResult <string> Delete(int keepId, int vaultId) { var userId = HttpContext.User.Identity.Name; bool successful = _vkr.Delete(keepId, vaultId, userId); if (!successful) { return(BadRequest()); } return(Ok()); }
internal string Delete(int id, Profile userInfo) { var data = GetById(id, userInfo); if (data.CreatorId != userInfo.Id) { throw new Exception("You must own this Vault to delete it."); } _repo.Delete(id); return("Successfully Deleted"); }
public ActionResult <string> Delete(VaultKeep value) { try { var userId = HttpContext.User.FindFirstValue("Id"); value.UserId = userId; return(Ok(_repo.Delete(value))); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult <String> Delete([FromBody] VaultKeep value) { try { string currentUser = HttpContext.User.FindFirstValue("Id"); value.UserId = currentUser; return(Ok(_repo.Delete(value))); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult <string> Put([FromBody] VaultKeep vk) { try { var Userid = HttpContext.User.FindFirstValue("Id"); vk.UserId = Userid; return(Ok(_repo.Delete(vk))); } catch (Exception e) { return(BadRequest(e.Message)); } }
internal void Delete(int id, string userId) { VaultKeep vaultkeep = _repo.GetById(id); if (vaultkeep == null) { throw new Exception("Invalid ID"); } if (vaultkeep.CreatorId != userId) { throw new Exception("You can only interact with your own private data"); } _repo.Delete(id); }
internal string delete(int id, int keepId, string userId) { // VaultKeep check = _repo.Check(vaultKeep); // if (check != null) // { _keepsService.decreaseKeepCount(keepId); bool deleted = _repo.Delete(id, userId); if (!deleted) { throw new Exception("something went wrong"); } // } return("deleted!"); }
internal string Delete(int id, string userId) { VaultKeep data = _repo.FindOne(id); if (data == null) { throw new Exception("Bad Id"); } if (data.CreatorId != userId) { throw new Exception("Not user, Access Denied"); } if (_repo.Delete(data.Id)) { return("deleted succesfully"); } return("did not remove succesfully"); }
public string Delete(int id, string userId) { VaultKeep original = _repo.GetOne(id); if (original == null) { throw new System.Exception("No keeps in that vault"); } if (original.CreatorId != userId) { throw new System.Exception("Access is denied"); } if (_repo.Delete(id)) { return("Successfully deleted"); } return("Not deleted"); }