コード例 #1
0
        internal DTOVaultKeep Delete(int id)
        {
            DTOVaultKeep exists = Get(id);

            _repo.Delete(id);
            return(exists);
        }
コード例 #2
0
ファイル: VaultKeepsService.cs プロジェクト: JacobGrow/Keepr
        //  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
ファイル: VaultKeepsService.cs プロジェクト: JakeCarp/keepr
        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
ファイル: VaultKeepsService.cs プロジェクト: JoeAlmanza/keepr
        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));
 }