Пример #1
0
        public VaultKeeps Create(VaultKeeps newVaultKeeps)
        {
            int id = _vkr.Create(newVaultKeeps);

            newVaultKeeps.Id = id;
            return(newVaultKeeps);
        }
Пример #2
0
 internal void Create(VaultKeep newData)
 {
     // NOTE works but commented out for testing purposes
     // VaultKeep exists = _repo.Find(newData);
     // if (exists != null) { throw new Exception("You aleady have this keep"); }
     _repo.Create(newData);
 }
Пример #3
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            int id = _repo.Create(newVaultKeep);

            newVaultKeep.Id = id;
            return(newVaultKeep);
        }
Пример #4
0
 // public DTOVaultKeep Get(int Id)
 // {
 //   DTOVaultKeep exists = _repo.GetById(Id);
 //   if (exists == null)
 //   {
 //     throw new Exception("Invalid vaultkeep");
 //   }
 //   return exists;
 // }
 public DTOVaultKeep Create(DTOVaultKeep newVaultKeep)
 {
     // if (_repo.hasRelationship(newVaultKeep))
     // {
     //   throw new Exception("That's already in your vault");
     // }
     return(_repo.Create(newVaultKeep));
 }
Пример #5
0
 internal DTOVaultedKeep Create(DTOVaultedKeep DTOVK)
 {
     if (_repo.hasRelationship(DTOVK))
     {
         throw new Exception("you already have that keep in this vault");
     }
     return(_repo.Create(DTOVK));
 }
Пример #6
0
 internal DTOVaultKeep Create(DTOVaultKeep newVaultKeep)
 {
     if (_repo.hasRelationship(newVaultKeep))
     {
         throw new Exception("That Keep is Already in that Vault");
     }
     return(_repo.Create(newVaultKeep));
 }
Пример #7
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;
        }
Пример #8
0
        public VaultKeep Create(VaultKeep newVaultKeep, string userId)
        {
            newVaultKeep.UserId = userId;
            int id = _repo.Create(newVaultKeep);

            newVaultKeep.Id = id;
            return(newVaultKeep);
        }
Пример #9
0
        // internal object GetById(int id, string userId)
        // {
        //     throw new NotImplementedException();
        // }

        public VaultKeep Create(VaultKeep newData)
        {
            // VaultKeep exists = _repo.Find(newData.KeepId, newData.VaultId, newData.UserId);
            // if (exists != null) { return exists; }
            // exists = _repo.Create(newData);
            // return exists;
            return(_repo.Create(newData));
        }
Пример #10
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            VaultKeep data = _vaultKeepRepo.FindByKeepId(newVaultKeep);

            if (data == null)
            {
                return(_vaultKeepRepo.Create(newVaultKeep));
            }
            throw new Exception("Keep already in vault");
        }
Пример #11
0
        internal void Create(VaultKeep newData)
        {
            VaultKeep found = _repo.Find(newData);

            if (found != null)
            {
                throw new Exception("Keep already saved to vault.");
            }
            _repo.Create(newData);
        }
Пример #12
0
        internal void Create(VaultKeep newData)
        {
            VaultKeep exists = _repo.Find(newData);

            if (exists != null)
            {
                throw new Exception("This is already in your collection");
            }
            _repo.Create(newData);
        }
Пример #13
0
 internal VaultKeep Create(VaultKeep newVaultKeep, string id)
 {
     if (newVaultKeep.CreatorId != id)
     {
         throw new System.Exception("can't add keeps to other peoples vaults");
     }
     _repo.Create(newVaultKeep);
     _krepo.KeepInc(newVaultKeep.KeepId);
     return(newVaultKeep);
 }
Пример #14
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            Keep foundKeep = _keepsService.GetById(newVaultKeep.KeepId);

            foundKeep.Keeps = foundKeep.Keeps + 1;
            string nonAuthor = "nonAuthor123";

            _keepsService.Update(foundKeep, nonAuthor);
            return(_repo.Create(newVaultKeep));
        }
Пример #15
0
        public VaultKeep Create(VaultKeep newVKeep)
        {
            //NOTE already validated by _vs and _ks
            int id = _repo.Create(newVKeep);

            // Update keep Count in target keep
            _kRepo.KeepIncrease(newVKeep.KeepId);
            newVKeep.Id = id;
            return(newVKeep);
        }
Пример #16
0
        internal void Create(VaultKeep newData)
        {
            VaultKeep exists = _repo.Find(newData);

            if (exists == null)
            {
                _repo.Create(newData);
            }
            return;
        }
Пример #17
0
        public void Create(VaultKeep newVaultKeep)
        {
            VaultKeep exists = _repo.Find(newVaultKeep);

            if (exists != null)
            {
                throw new Exception("Keep already in Vault");
            }
            _repo.Create(newVaultKeep);
            // return "Success";
        }
Пример #18
0
        internal VaultKeep Create(string userId, VaultKeep newVc)
        {
            var data = _vRepo.GetVaultById(newVc.VaultId.ToString());

            if (data.CreatorId != userId)
            {
                throw new Exception("This is not your Vault");
            }
            newVc.Id = _repo.Create(newVc);
            return(newVc);
        }
Пример #19
0
        public VaultKeep Create(VaultKeep newVaultKeep)
        {
            var exists = _vkRepo.GetByIds(newVaultKeep.VaultId, newVaultKeep.KeepId);

            if (exists != null)
            {
                throw new Exception("Pic already in vault");
            }
            _vkRepo.Create(newVaultKeep);
            return(newVaultKeep);
        }
Пример #20
0
        internal VaultKeep Create(VaultKeep newVk)
        {
            var data = _vrepo.GetById(newVk.VaultId);

            if (data.CreatorId != newVk.CreatorId)
            {
                throw new Exception("Cannot add Keeps to a Vault You Don't Own");
            }
            int id = _repo.Create(newVk);

            newVk.Id = id;
            return(newVk);
        }
Пример #21
0
        internal string Create(VaultKeep newData)
        {
            VaultKeep exists = _vkr.Find(newData.KeepId, newData.VaultId);

            if (exists == null)
            {
                _vkr.Create(newData);
            }
            else if (exists != null)
            {
                return("Already exists");
            }
            return("Successfully Created");
        }
Пример #22
0
        internal VaultKeep Create(VaultKeep vaultKeepData)
        {
            VaultKeep exists = _repo.Find(vaultKeepData.KeepId, vaultKeepData.VaultId);

            if (exists == null)
            {
                _repo.Create(vaultKeepData);
            }
            else if (exists != null)
            {
                return(vaultKeepData);
            }
            return(vaultKeepData);
        }
Пример #23
0
        internal string Create(VaultKeep newVaultKeep)
        {
            VaultKeep exists = _vaultKeepRepo.Find(newVaultKeep.KeepId, newVaultKeep.VaultId);

            if (exists == null)
            {
                _vaultKeepRepo.Create(newVaultKeep);
            }
            else if (exists != null)
            {
                return("already exists");
            }
            return("successfull");
        }
Пример #24
0
        internal string Create(VaultKeep newData)
        {
            VaultKeep exists = _repo.Find(newData.KeepId, newData.VaultId);

            if (exists == null)
            {
                _repo.Create(newData);
            }
            else if (exists != null)
            {
                return("THIS HAS ALREADY BEEN CREATED");
            }
            return("successfuly created");
        }
Пример #25
0
        // public VaultKeep Create(VaultKeep newVaultKeep)
        public VaultKeep Create(VaultKeep newVaultKeep)
        {
            /////removing this part for testing...
            // VaultKeep existenceTest = _repo.Find(newVaultKeep);
            // if (existenceTest != null) { throw new Exception("already ready created, vaultkeep service creator"); }



            //  {return existenceTest;}
            // { throw new Exception("already ready created, vaultkeep service creator"); }
            // { return; }
            _repo.Create(newVaultKeep);
            return(newVaultKeep);
        }
Пример #26
0
        internal VaultKeep Create(VaultKeep newVK)
        {
            Vault vault = _vr.GetById(newVK.VaultId);

            if (vault.CreatorId != newVK.CreatorId)
            {
                throw new Exception("you can't add keeps to other people's vaults");
            }
            Keep keep = _kr.GetById(newVK.KeepId);

            keep.Keeps = keep.Keeps + 1;
            _kr.Edit(keep);
            newVK.Id = _repo.Create(newVK);
            return(newVK);
        }
Пример #27
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            Vault vaultCheck = _vaultsService.GetById(newVaultKeep.VaultId, newVaultKeep.CreatorId);

            if (vaultCheck.CreatorId == newVaultKeep.CreatorId)
            {
                int id = _repo.Create(newVaultKeep);
                newVaultKeep.Id = id;
                return(newVaultKeep);
            }
            else
            {
                throw new Exception("Invalid");
            }
        }
Пример #28
0
        internal VaultKeep Create(Profile userInfo, VaultKeep newVaultKeep)
        {
            newVaultKeep.Id = _repo.Create(newVaultKeep);
            Vault vault = _vRepo.GetById(newVaultKeep.VaultId);

            if (vault.CreatorId != userInfo.Id)
            {
                throw new Exception("You do not own this Vault");
            }
            Keep data = _kRepo.GetById(newVaultKeep.KeepId);

            data.Keeps++;
            _kRepo.Edit(data);
            return(newVaultKeep);
        }
Пример #29
0
        internal void Create(VaultKeep newData)
        {
            VaultKeep exists = _repo.GetById(newData.Id);

            if (exists != null)
            {
                throw new Exception("Relationship already exists");
            }
            // Pretty sure I don't need this on create...
            // else if (exists.UserId != newData.UserId)
            // {
            //   throw new Exception("");
            // }
            _repo.Create(newData);
        }
Пример #30
0
        /// <summary>
        /// creates a new relation. checks for private / public
        /// </summary>
        /// <param name="newRelation">a vaultKeep object representign the new assiciation</param>
        /// <param name="userId">the user trying to create the association</param>
        internal VaultKeep Create(VaultKeep newRelation, string userId)
        {
            Keep foundKeep = _krepo.Get(newRelation.KeepId, false);

            // two states:
            // found, is private, not created by person makign the request
            // found, not private

            if (foundKeep.IsPrivate && foundKeep.UserId != userId)
            {
                throw new ArgumentNullException(nameof(newRelation.KeepId), "That Keep does not exist");
            }
            // found is public or we made it and it is private

            // _vrepo.Get does userId checking internally
            Vault foundVault = _vrepo.Get(newRelation.VaultId, userId);


            newRelation.UserId = userId;
            return(_repo.Create(newRelation));
        }