Example #1
0
 public ActionResult Delete(int id)
 {
     if (_vaultkeepsRepo.DeleteVaultKeep(id))
     {
         return(Ok("Successfully Removed Keep!"));
     }
     return(NotFound());
 }
        public ActionResult <string> DeleteVaultKeep([FromBody] VaultKeep vaultKeep)
        {
            var result = _repo.DeleteVaultKeep(vaultKeep);

            if (result != false)
            {
                return(Ok("deleted vault keep"));
            }
            return(BadRequest("not deleted"));
        }
Example #3
0
 public ActionResult <String> Put([FromBody] VaultKeep value)
 {
     try
     {
         string userId = HttpContext.User.FindFirstValue("Id");
         value.UserId = userId;
         return(Ok(_repo.DeleteVaultKeep(value)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Example #4
0
        public ActionResult <int> Put([FromBody] VaultKeep vaultKeep)
        {
            vaultKeep.UserId = HttpContext.User.FindFirstValue("Id");

            try
            {
                _repo.DeleteVaultKeep(vaultKeep);
                return(Ok("Successfully Deleted"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
        public ActionResult <string> DeleteVaultKeep(VaultKeep vk)
        {
            VaultKeep intermediate = vk;

            if (vk.UserId == null)
            {
                intermediate.UserId = HttpContext.User.FindFirstValue("Id");
            }

            //completely unsafe at this level; userid not checked?
            //TODO needs a little love to make sure there's not too much mess up
            if (_vkRepo.DeleteVaultKeep(intermediate))
            {
                return(Ok(vk));
            }
            return(BadRequest());
        }