Example #1
0
        public ActionResult <string> Delete(int id)
        {
            bool successful = _vr.Delete(id);

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

            if (!successful)
            {
                return(BadRequest("Cannot Delete"));
            }
            return(Ok("successfully deleted"));
        }
Example #3
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         return(Ok(_repo.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Example #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);
        }
Example #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");
        }
Example #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");
        }
Example #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");
        }
Example #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");
        }
Example #9
0
 [HttpDelete("{id}")]//one Vault
 public string Delete(int id)
 {
     return(_repo.Delete(id));
 }