Exemplo n.º 1
0
        public ActionResult <string> Delete(int id)
        {
            bool successful = _vr.Delete(id);

            if (!successful)
            {
                return(BadRequest());
            }
            return(Ok());
        }
Exemplo n.º 2
0
        public ActionResult <string> Delete(int id)
        {
            bool successful = _vr.Delete(id);

            if (!successful)
            {
                return(BadRequest("Cannot Delete"));
            }
            return(Ok("successfully deleted"));
        }
Exemplo n.º 3
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         return(Ok(_repo.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Exemplo n.º 4
0
        internal Vault Delete(int id, string userId)
        {
            Vault original = GetById(id, userId);

            if (userId != original.CreatorId)
            {
                throw new Exception("You can only delete your own data");
            }
            _repo.Delete(id);
            return(original);
        }
Exemplo n.º 5
0
        public string Delete(int id)
        {
            string Deleted      = "Vault Deleted";
            bool   deletedVault = _vr.Delete(id);

            if (deletedVault)
            {
                return(Deleted);
            }
            ;
            throw new Exception("Not a valid Vault");
        }
Exemplo n.º 6
0
        public string Delete(int id, string userId)
        {
            Vault original = _repo.GetSingleVault(id);

            if (original == null || original.CreatorId != userId)
            {
                throw new Exception("Invalid Request!");
            }
            if (_repo.Delete(id))
            {
                return("Successfully Deleted Vault");
            }
            return("Unsuccessful in Deleting Vault");
        }
Exemplo n.º 7
0
        public string Delete(int id, string userId)
        {
            Vault original = _repo.GetOne(id);

            if (userId != original.CreatorId)
            {
                throw new System.Exception("You are not the user : Access Denied");
            }
            if (original.IsPrivate == true)
            {
                if (_repo.Delete(id))
                {
                    return("Vault deleted");
                }
                return("Not deleted");
            }
            return("Cannot delete public Vault");
        }
Exemplo n.º 8
0
        internal string Delete(int id, string userId)
        {
            Vault data = _repo.Find(id);

            if (data == null)
            {
                throw new Exception("Bad Id");
            }
            if (data.CreatorId != userId)
            {
                throw new Exception("Not user, Access Denied");
            }
            if (_repo.Delete(id))
            {
                return("deleted succesfully");
            }
            return("did not remove succesfully");
        }
Exemplo n.º 9
0
 [HttpDelete("{id}")]//one Vault
 public string Delete(int id)
 {
     return(_repo.Delete(id));
 }