internal DTOVaultKeep Delete(int id) { DTOVaultKeep exists = Get(id); _repo.Delete(id); return(exists); }
// internal VaultKeepViewModel Create(VaultKeepViewModel newVaultKeep) // { // int id = _repo.Create(newVaultKeep); // newVaultKeep.Id = id; // return newVaultKeep; // } // internal DTOVaultKeep Delete(int id) // { // DTOVaultKeep exists = (DTOVaultKeep)GetById(id); // _repo.Delete(id); // return exists; // } internal DTOVaultKeep Delete(int id, string userId) { DTOVaultKeep exists = GetById(id); _repo.Delete(id, userId); return(exists); }
public string Delete(int id, string userId) { VaultKeep exists = Get(id, userId); _repo.Delete(id); return("VaultKeep successfully deleted."); }
public DTOVaultKeep Delete(string userId, int id) { DTOVaultKeep exists = GetById(id); _repo.Delete(id, userId); return(exists); }
internal VaultKeep Delete(int id, string userId) { var vaultKeep = isVaultKeepOwner(id, userId); _repo.Delete(id); _ks.decrementKeeps(vaultKeep.KeepId); return(vaultKeep); }
public ActionResult <string> Delete(int id) { bool successful = _vkr.Delete(id); if (!successful) { return(BadRequest()); } return(Ok()); }
public ActionResult <string> Delete(int vaultId, int keepId) { string userId = HttpContext.User.Identity.Name; bool successful = _vkr.Delete(vaultId, keepId, userId); if (!successful) { return(BadRequest("Delete failed!")); } return(Ok()); }
internal object Delete(int id, string userId) { var data = GetById(id); if (data.CreatorId != userId) { throw new Exception("Invalid Edit Permissions"); } _repo.Delete(id); return("Successfully Deleted"); }
internal VaultKeep Delete(string userId, int id) { VaultKeep found = GetById(id); if (found.UserId != userId) { throw new Exception("this is not yours!"); } if (_repo.Delete(id, userId)) { return(found); } throw new Exception("something bad happened"); }
///<summary> ///Deletes Vault-Keep, checks that the vault-keep is an actual vault-keep, then it checks if the user is /// the original creator of said vault-keep. ///</summary> internal void Delete(int id, string userId) { VaultKeep keep = _repo.GetById(id); if (keep == null) { throw new Exception("Invalid aye"); } if (keep.CreatorId != userId) { throw new Exception("Invalid User"); } _repo.Delete(id); }
internal void delete(int id, string userId) { VaultKeep toDelete = _repo.GetById(id); if (toDelete == null) { throw new Exception("invalid id"); } if (toDelete.CreatorId != userId) { throw new Exception("cannot delete if you are not the creator"); } _repo.Delete(id); }
internal string DeleteAsync(int vaultKeepId, string userId) { VaultKeep originalVK = _vkRepo.Get(vaultKeepId); Vault original = _vService.Get(originalVK.VaultId, userId); Keep originalKeep = _kService.Get(originalVK.KeepId); Console.WriteLine("yo" + originalKeep.Id); if (userId != original.CreatorId) { throw new Exception("You can't access this."); } _vkRepo.Delete(vaultKeepId, originalKeep.Id); return("deleted"); }
internal void Delete(int id, string userId) { VaultKeep vk = _vkrepo.GetById(id); if (vk == null) { throw new Exception("Invalid Id"); } if (vk.CreatorId != userId) { throw new Exception("Invalid User"); } _vkrepo.Delete(id, vk.KeepId); }
internal bool Delete(int id, string userId) { VaultKeep found = GetVaultKeep(id); if (found == null) { throw new Exception("no vault by that id"); } if (found.UserId == userId) { return(_repo.Delete(id, userId)); } throw new Exception("hmmm we couldnt seem to find anything are you a hacker?"); }
public string Delete(int id, Profile userInfo) { VaultKeep original = _repo.GetById(id); if (original.CreatorId == userInfo.Id) { if (_repo.Delete(id)) { return("The Vault Keep has been deleted."); } return("Can't delete"); } else { return("Access not granted!"); } }
internal string Delete(int id, Profile userInfo) { VaultKeep returnedVaultKeep = _repo.GetOne(id); if (returnedVaultKeep.CreatorId == userInfo.Id) { if (_repo.Delete(id)) { return("Deleted!"); } return("Unable to be deleted"); } else { throw new Exception("Access Denied"); } }
public string Delete(int id, string userId) { VaultKeep original = _repo.Get(id); if (original == null) { throw new Exception("Bad Id"); } if (original.CreatorId != userId) { throw new Exception("Not the User : Access Denied"); } if (_repo.Delete(id)) { return("deleted succesfully"); } return("did not remove succesfully"); }
internal void Delete(int id, string userId) { // var data = _vkrepo.GetById(id); // if (data == null) // { // throw new Exception("Invalid Id"); // } // if (data.CreatorId != userId) // { // throw new Exception("You're not the owner."); // } int affected = _vkrepo.Delete(id, userId); if (affected < 1) { throw new Exception("You're not the owner."); } }
internal Boolean Delete(int id, Profile userInfo) { VaultKeep original = _vaultKeepsRepository.GetOne(id, userInfo); if (original == null) { throw new Exception("Cannot find <VaultKeep> with that <Id>"); } if (original.CreatorId != userInfo.Id) { throw new Exception("Invalid <VaultKeep> creator"); } _vaultKeepsRepository.Delete(id); original = _vaultKeepsRepository.GetOne(id, userInfo); if (original == null) { return(true); } else { throw new Exception("Failed to delete <VaultKeep>"); } }
internal void Delete(int id) { //NOTE getbyid to validate its valid and you are the creator _repo.Delete(id); }
public VaultKeep Delete(VaultKeep vaultKeep) { return(_repo.Delete(vaultKeep)); }