internal DTOVaultKeep Delete(int id)
        {
            DTOVaultKeep exists = Get(id);

            _repo.Delete(id);
            return(exists);
        }
예제 #2
0
        //  internal VaultKeepViewModel Create(VaultKeepViewModel newVaultKeep)
        // {
        //   int id = _repo.Create(newVaultKeep);
        //   newVaultKeep.Id = id;
        //   return newVaultKeep;
        // }


        // internal DTOVaultKeep Delete(int id)
        // {
        //   DTOVaultKeep exists = (DTOVaultKeep)GetById(id);
        //   _repo.Delete(id);
        //   return exists;
        // }

        internal DTOVaultKeep Delete(int id, string userId)
        {
            DTOVaultKeep exists = GetById(id);

            _repo.Delete(id, userId);
            return(exists);
        }
예제 #3
0
        public string Delete(int id, string userId)
        {
            VaultKeep exists = Get(id, userId);

            _repo.Delete(id);
            return("VaultKeep successfully deleted.");
        }
예제 #4
0
        public DTOVaultKeep Delete(string userId, int id)
        {
            DTOVaultKeep exists = GetById(id);

            _repo.Delete(id, userId);
            return(exists);
        }
예제 #5
0
        internal VaultKeep Delete(int id, string userId)
        {
            var vaultKeep = isVaultKeepOwner(id, userId);

            _repo.Delete(id);
            _ks.decrementKeeps(vaultKeep.KeepId);
            return(vaultKeep);
        }
예제 #6
0
        public ActionResult <string> Delete(int id)
        {
            bool successful = _vkr.Delete(id);

            if (!successful)
            {
                return(BadRequest());
            }
            return(Ok());
        }
예제 #7
0
        public ActionResult <string> Delete(int vaultId, int keepId)
        {
            string userId     = HttpContext.User.Identity.Name;
            bool   successful = _vkr.Delete(vaultId, keepId, userId);

            if (!successful)
            {
                return(BadRequest("Delete failed!"));
            }
            return(Ok());
        }
예제 #8
0
        internal object Delete(int id, string userId)
        {
            var data = GetById(id);

            if (data.CreatorId != userId)
            {
                throw new Exception("Invalid Edit Permissions");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
예제 #9
0
        internal VaultKeep Delete(string userId, int id)
        {
            VaultKeep found = GetById(id);

            if (found.UserId != userId)
            {
                throw new Exception("this is not yours!");
            }
            if (_repo.Delete(id, userId))
            {
                return(found);
            }
            throw new Exception("something bad happened");
        }
예제 #10
0
        ///<summary>
        ///Deletes Vault-Keep, checks that the vault-keep is an actual vault-keep, then it checks if the user is
        /// the original creator of said vault-keep.
        ///</summary>
        internal void Delete(int id, string userId)
        {
            VaultKeep keep = _repo.GetById(id);

            if (keep == null)
            {
                throw new Exception("Invalid aye");
            }
            if (keep.CreatorId != userId)
            {
                throw new Exception("Invalid User");
            }
            _repo.Delete(id);
        }
예제 #11
0
        internal void delete(int id, string userId)
        {
            VaultKeep toDelete = _repo.GetById(id);

            if (toDelete == null)
            {
                throw new Exception("invalid id");
            }
            if (toDelete.CreatorId != userId)
            {
                throw new Exception("cannot delete if you are not the creator");
            }
            _repo.Delete(id);
        }
예제 #12
0
        internal string DeleteAsync(int vaultKeepId, string userId)
        {
            VaultKeep originalVK   = _vkRepo.Get(vaultKeepId);
            Vault     original     = _vService.Get(originalVK.VaultId, userId);
            Keep      originalKeep = _kService.Get(originalVK.KeepId);

            Console.WriteLine("yo" + originalKeep.Id);
            if (userId != original.CreatorId)
            {
                throw new Exception("You can't access this.");
            }
            _vkRepo.Delete(vaultKeepId, originalKeep.Id);
            return("deleted");
        }
예제 #13
0
        internal void Delete(int id, string userId)
        {
            VaultKeep vk = _vkrepo.GetById(id);

            if (vk == null)
            {
                throw new Exception("Invalid Id");
            }
            if (vk.CreatorId != userId)
            {
                throw new Exception("Invalid User");
            }
            _vkrepo.Delete(id, vk.KeepId);
        }
예제 #14
0
        internal bool Delete(int id, string userId)
        {
            VaultKeep found = GetVaultKeep(id);

            if (found == null)
            {
                throw new Exception("no vault by that id");
            }
            if (found.UserId == userId)
            {
                return(_repo.Delete(id, userId));
            }
            throw new Exception("hmmm we couldnt seem to find anything are you a hacker?");
        }
예제 #15
0
        public string Delete(int id, Profile userInfo)
        {
            VaultKeep original = _repo.GetById(id);

            if (original.CreatorId == userInfo.Id)
            {
                if (_repo.Delete(id))
                {
                    return("The Vault Keep has been deleted.");
                }
                return("Can't delete");
            }
            else
            {
                return("Access not granted!");
            }
        }
예제 #16
0
        internal string Delete(int id, Profile userInfo)
        {
            VaultKeep returnedVaultKeep = _repo.GetOne(id);

            if (returnedVaultKeep.CreatorId == userInfo.Id)
            {
                if (_repo.Delete(id))
                {
                    return("Deleted!");
                }
                return("Unable to be deleted");
            }
            else
            {
                throw new Exception("Access Denied");
            }
        }
예제 #17
0
        public string Delete(int id, string userId)
        {
            VaultKeep original = _repo.Get(id);

            if (original == null)
            {
                throw new Exception("Bad Id");
            }
            if (original.CreatorId != userId)
            {
                throw new Exception("Not the User : Access Denied");
            }
            if (_repo.Delete(id))
            {
                return("deleted succesfully");
            }
            return("did not remove succesfully");
        }
예제 #18
0
        internal void Delete(int id, string userId)
        {
            // var data = _vkrepo.GetById(id);
            // if (data == null)
            // {

            //     throw new Exception("Invalid Id");
            // }
            // if (data.CreatorId != userId)
            // {

            //     throw new Exception("You're not the owner.");
            // }
            int affected = _vkrepo.Delete(id, userId);

            if (affected < 1)
            {
                throw new Exception("You're not the owner.");
            }
        }
예제 #19
0
        internal Boolean Delete(int id, Profile userInfo)
        {
            VaultKeep original = _vaultKeepsRepository.GetOne(id, userInfo);

            if (original == null)
            {
                throw new Exception("Cannot find <VaultKeep> with that <Id>");
            }
            if (original.CreatorId != userInfo.Id)
            {
                throw new Exception("Invalid <VaultKeep> creator");
            }
            _vaultKeepsRepository.Delete(id);
            original = _vaultKeepsRepository.GetOne(id, userInfo);
            if (original == null)
            {
                return(true);
            }
            else
            {
                throw new Exception("Failed to delete <VaultKeep>");
            }
        }
예제 #20
0
 internal void Delete(int id)
 {
     //NOTE getbyid to validate its valid and you are the creator
     _repo.Delete(id);
 }
예제 #21
0
 public VaultKeep Delete(VaultKeep vaultKeep)
 {
     return(_repo.Delete(vaultKeep));
 }