Пример #1
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            int id = _repo.Create(newVaultKeep);

            newVaultKeep.Id = id;
            return(newVaultKeep);
        }
Пример #2
0
        // 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;
        }
Пример #3
0
 internal VaultKeep Create(VaultKeep newVK, Vault vault)
 {
     if (vault.CreatorId != newVK.CreatorId)
     {
         throw new Exception("Invalid Permissions");
     }
     return(_repo.Create(newVK));
 }
Пример #4
0
 internal VaultKeep Create(VaultKeep newVaultKeep)
 {
     // if (_repo.hasRelationship(newVaultKeep))
     // {
     //   throw new Exception("you already have that in your vault");
     // }
     return(_repo.Create(newVaultKeep));
 }
Пример #5
0
        internal VaultKeep CreateVaultKeep(VaultKeep newVaultKeep)
        {
            newVaultKeep.Id = _vkRepo.Create(newVaultKeep);
            Keep vKeep = _kRepo.Get(newVaultKeep.KeepId);

            vKeep.Keeps++;
            _kRepo.Edit(vKeep);
            return(newVaultKeep);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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));
        }
Пример #8
0
 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));
     }
 }
Пример #9
0
 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);
 }
Пример #10
0
        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");
            }
        }
Пример #11
0
        ///<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));
        }
Пример #12
0
        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);
        }
Пример #13
0
        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);
        }
Пример #14
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            Vault vault = _vs.GetById(newVaultKeep.VaultId, newVaultKeep.CreatorId);

            return(_repo.Create(newVaultKeep));
        }
Пример #15
0
 public VaultKeep Create(VaultKeep newVaultKeep)
 {
     newVaultKeep.id = _repo.Create(newVaultKeep);
     return(newVaultKeep);
 }
Пример #16
0
 public DTOVaultKeep Create(DTOVaultKeep newDTOVaultKeep)
 {
     return(_repo.Create(newDTOVaultKeep));
 }
Пример #17
0
 public VaultKeep Create(VaultKeep vaultKeep)
 {
     vaultKeep.Id = _repo.Create(vaultKeep);
     return(vaultKeep);
 }
Пример #18
0
 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));
 }
Пример #19
0
 internal VaultKeep Create(VaultKeep vaultKeep)
 {
     return(_repo.Create(vaultKeep));
 }
Пример #20
0
 internal DTOVaultKeep Create(DTOVaultKeep newVault)
 {
     return(_repo.Create(newVault));
 }
Пример #21
0
 public VaultKeep Create(VaultKeep vaultKeep)
 {
     return(_repo.Create(vaultKeep));
 }