internal VaultKeep Create(VaultKeep newVaultKeep) { int id = _repo.Create(newVaultKeep); newVaultKeep.Id = id; return(newVaultKeep); }
// public IEnumerable<VaultKeep> GetKeepsByVaultId(int id) // { // return _repo.GetKeepsByVaultId(id); // } public VaultKeep Create(VaultKeep newVaultKeep) { // TODO prevent duplicates from being created. return(_repo.Create(newVaultKeep)); // int id = _repo.Create(newVaultKeep); // newVaultKeep.id = id; // return newVaultKeep; }
internal VaultKeep Create(VaultKeep newVK, Vault vault) { if (vault.CreatorId != newVK.CreatorId) { throw new Exception("Invalid Permissions"); } return(_repo.Create(newVK)); }
internal VaultKeep Create(VaultKeep newVaultKeep) { // if (_repo.hasRelationship(newVaultKeep)) // { // throw new Exception("you already have that in your vault"); // } return(_repo.Create(newVaultKeep)); }
internal VaultKeep CreateVaultKeep(VaultKeep newVaultKeep) { newVaultKeep.Id = _vkRepo.Create(newVaultKeep); Keep vKeep = _kRepo.Get(newVaultKeep.KeepId); vKeep.Keeps++; _kRepo.Edit(vKeep); return(newVaultKeep); }
public VaultKeep Create(VaultKeep newVaultKeep) { Vault vault = _vaultsRepository.GetOne(newVaultKeep.VaultId); if (newVaultKeep.CreatorId != vault.CreatorId) { throw new Exception("Invalid <VaultKeep> creator"); } newVaultKeep.Id = _vaultKeepsRepository.Create(newVaultKeep); return(newVaultKeep); }
internal VaultKeep CreateAsync(VaultKeep newVK, string userId) { List <VaultKeepModel> vk = _vkRepo.GetByVaultId(newVK.VaultId).ToList(); // List<VaultKeepModel> filtered = vk.Where(vk => vk.Keeps. == newVK.KeepId).ToList(); // if (filtered.Any()) // { // throw new Exception("You already added this."); // } return(_vkRepo.Create(newVK)); }
public ActionResult <VaultKeeps> Post([FromBody] VaultKeeps value) { try { var userId = HttpContext.User.FindFirstValue("Id"); value.UserId = userId; return(Ok(_repo.Create(value))); } catch (Exception e) { return(BadRequest(e)); } }
public VaultKeep Create(VaultKeep newVk, string userId, Vault selectedVault) { if (selectedVault == null) { throw new Exception("Bad Id"); } if (selectedVault.CreatorId != userId) { throw new Exception("Not Your Vault"); } newVk.Id = _repo.Create(newVk); return(newVk); }
internal VaultKeep Create(VaultKeep newVaultKeep, Profile userInfo) { Vault foundVault = _vaultService.GetOne(newVaultKeep.VaultId, userInfo); if (foundVault.CreatorId == userInfo.Id) { newVaultKeep.Id = _repo.Create(newVaultKeep); return(newVaultKeep); } else { throw new Exception("Access Denied"); } }
///<summary> ///Creates new Vault-Keep, if the vault is null it will throw an error, if you are not the original /// creator, an error will be thrown. ///</summary> internal VaultKeep Create(VaultKeep newVaultKeep) { Vault vault = _vrepo.GetById(newVaultKeep.VaultId); if (vault == null) { throw new Exception("Not a valid vault dude"); } if (vault.CreatorId != newVaultKeep.CreatorId) { throw new Exception("You are not the owner of this vault buddy"); } return(_repo.Create(newVaultKeep)); }
public VaultKeep Create(VaultKeep newVk, string userId) { Vault original = _vr.GetOne(newVk.VaultId); if (original == null) { throw new Exception("Bad Id"); } if (original.CreatorId != userId) { throw new Exception("Not the User : Access Denied"); } newVk.Id = _repo.Create(newVk); return(newVk); }
internal VaultKeep Create(VaultKeep newVaultKeep, string userId) { Vault vault = _vrepo.Get(newVaultKeep.VaultId); Keep keep = _krepo.GetOne(newVaultKeep.KeepId); if (keep == null) { throw new Exception("invalid keep id"); } if (vault == null) { throw new Exception("invalid vault id"); } if (vault.CreatorId != userId) { throw new Exception("you are not the owner of this vault"); } int id = _repo.Create(newVaultKeep); newVaultKeep.Id = id; keep.Keeps = keep.Keeps + 1; _krepo.AddKeep(keep); return(newVaultKeep); }
internal VaultKeep Create(VaultKeep newVaultKeep) { Vault vault = _vs.GetById(newVaultKeep.VaultId, newVaultKeep.CreatorId); return(_repo.Create(newVaultKeep)); }
public VaultKeep Create(VaultKeep newVaultKeep) { newVaultKeep.id = _repo.Create(newVaultKeep); return(newVaultKeep); }
public DTOVaultKeep Create(DTOVaultKeep newDTOVaultKeep) { return(_repo.Create(newDTOVaultKeep)); }
public VaultKeep Create(VaultKeep vaultKeep) { vaultKeep.Id = _repo.Create(vaultKeep); return(vaultKeep); }
internal VaultKeep Create(VaultKeep newVK) { //TODO if they are creating a wishlistproduct, make sure they are the creator of the list return(_vkrepo.Create(newVK)); }
internal VaultKeep Create(VaultKeep vaultKeep) { return(_repo.Create(vaultKeep)); }
internal DTOVaultKeep Create(DTOVaultKeep newVault) { return(_repo.Create(newVault)); }
public VaultKeep Create(VaultKeep vaultKeep) { return(_repo.Create(vaultKeep)); }