Ejemplo n.º 1
0
        public VaultKeeps Create(VaultKeeps newVaultKeeps)
        {
            int id = _vkr.Create(newVaultKeeps);

            newVaultKeeps.Id = id;
            return(newVaultKeeps);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            int id = _repo.Create(newVaultKeep);

            newVaultKeep.Id = id;
            return(newVaultKeep);
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 8
0
        public VaultKeep Create(VaultKeep newVaultKeep, string userId)
        {
            newVaultKeep.UserId = userId;
            int id = _repo.Create(newVaultKeep);

            newVaultKeep.Id = id;
            return(newVaultKeep);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 16
0
        internal void Create(VaultKeep newData)
        {
            VaultKeep exists = _repo.Find(newData);

            if (exists == null)
            {
                _repo.Create(newData);
            }
            return;
        }
Ejemplo n.º 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";
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }