public Vault Edit(Vault EditedVault) { Vault original = Get(EditedVault.Id, EditedVault.UserId); original.Name = EditedVault.Name != null ? EditedVault.Name : original.Name; original.Description = EditedVault.Description != null ? EditedVault.Description : original.Description; _repo.Edit(original); return(original); }
public Vault Edit(Vault newVault, string userId) { Vault vault = Get(newVault.Id, userId); vault.Name = newVault.Name; vault.Description = newVault.Description; _repo.Edit(vault); return(vault); }
public Vault Edit(Vault updatedVault) { Vault found = GetOne(updatedVault.Id, updatedVault.UserId); if (found.UserId != updatedVault.UserId) { throw new Exception("Invalid Request"); } return(_repo.Edit(found)); }
public Vault Edit(Vault update) { int v = _repo.Edit(update); if (v == 0) { throw new Exception("You can't do that?"); } return(update); }
internal Vault Edit(Vault updatedVault) { Vault found = Get(updatedVault.Id); if (found.UserId != updatedVault.UserId) { throw new Exception("Invalid Request or Privileges"); } found.Name = updatedVault.Name; found.Description = updatedVault.Description != null ? updatedVault.Description : found.Description; return _repo.Edit(found); }//endof edit
public Vault Edit(Vault updatedVault, string userId) { Vault foundVault = GetById(updatedVault.Id, userId); bool edited = _repo.Edit(updatedVault); if (!edited) { throw new Exception("You No Own This!"); } return(updatedVault); }
internal Vault Edit(Vault update) { var exists = _repo.GetById(update.Id); if (exists == null) { throw new Exception("Invalid ID"); } _repo.Edit(update); return(update); }
internal Vault Edit(Vault updatedVault, string userId) { Vault data = GetById(updatedVault.Id, userId); if (data.CreatorId != userId) { throw new Exception("Invalid Edit Permissions, This Vault isn't yours to Edit"); } updatedVault.Name = updatedVault.Name != null ? updatedVault.Name : data.Name; updatedVault.Description = updatedVault.Description != null ? updatedVault.Description : data.Description; return(_vaultsRepo.Edit(updatedVault)); }
internal Vault Edit(Vault VaultUpdate, string userId) { Vault found = GetById(VaultUpdate.Id, userId); if (found.UserId != userId) { throw new Exception("You can only delete your own vaults"); } if (_repo.Edit(VaultUpdate, userId)) { return(VaultUpdate); } throw new Exception("couldnt edit"); }
// VaultToUpdate (vtu) internal Vault Edit(Vault vtu) { Vault original = GetVaultById(vtu.Id, vtu.UserId); if (vtu == null || original.UserId != vtu.UserId) { throw new Exception("Invalid Id"); } original.Name = vtu.Name == null ? original.Name : vtu.Name; original.Description = vtu.Name == null ? original.Description : vtu.Description; // Author/userId is not to be changed. Ever. _repo.Edit(vtu); return(original); }
internal Vault Edit(Vault update) { Vault exists = _repo.GetById(update.Id); if (exists == null) { throw new Exception("Invalid Id"); } // if (exists.UserId != update.UserId) // { // throw new Exception("Invalid User"); // } _repo.Edit(update); return(update); }
internal Vault Edit(Vault update) { var found = _repo.GetById(update.Id); if (found == null) { throw new Exception("Invalid id"); } if (update.UserId != found.UserId) { throw new Exception("Unauthorized unauthorized unauthorized"); } _repo.Edit(update); return(update); }
internal string Edit(Vault update) { var exists = GetById(update.Id, update.UserId); if (exists == null) { throw new Exception("Invalid id"); } else if (update.UserId != exists.UserId) { throw new Exception("You do not own this Vault peasant!"); } _repo.Edit(update); return("Successfully Updated"); }
internal object Edit(Vault editVault, string id) { Vault original = _repo.GetById(editVault.Id); if (original == null) { throw new Exception("Invalid Id"); } if (original.CreatorId != id) { throw new Exception("You may only edit your own Vaults"); } editVault.Name = editVault.Name == null ? original.Name : editVault.Name; editVault.Description = editVault.Description == null ? original.Description : editVault.Description; return(_repo.Edit(editVault)); }
internal Vault Edit(Vault update) { var data = _repo.GetById(update.Id); if (data == null) { throw new Exception("Invalid Update Id"); } if (data.UserId == update.UserId) { _repo.Edit(update); return(update); } else { throw new Exception("You cannot edit vaults you didn't create"); } }
internal object Edit(Vault update, string userId) { //get the original vault and validate user access. Then check for null values in submission Vault original = _repo.GetById(update.Id); if (original == null) { throw new Exception("Invalid Id"); } if (original.CreatorId != userId) { throw new Exception("Access Denied... This is not yours"); } update.Name = update.Name == null ? original.Name : update.Name; update.Description = update.Description == null ? original.Description : update.Description; return(_repo.Edit(update)); }
internal Vault Edit(Vault vaultToUpdate, string userId) { return(_repo.Edit(vaultToUpdate)); }