public ActionResult <string> Delete(int id) { bool successful = _kr.Delete(id); if (!successful) { return(BadRequest()); } return(Ok()); }
internal Keep Delete(int id, string userId) { Keep original = GetById(id); if (userId != original.CreatorId) { throw new Exception("You can only delete your own data"); } _repo.Delete(id); return(original); }
public ActionResult <string> Delete(int id) { string userId = HttpContext.User.Identity.Name; bool successful = _kr.Delete(id, userId); if (!successful) { return(BadRequest("Cannot Delete")); } return(Ok("successfully deleted")); }
public string Delete(int id) { string Deleted = "Keep Deleted"; bool deletedKeep = _kr.Delete(id); if (deletedKeep) { return(Deleted); } ; throw new Exception("Not a valid Keep"); }
public ActionResult <String> Delete(int id) { try { var userId = HttpContext.User.FindFirstValue("Id"); return(Ok(_repo.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e)); } }
public string Delete(int id, string userId) { Keep original = _repo.GetOne(id); if (original == null) { throw new System.Exception("Bad Id"); } if (original.CreatorId != userId) { throw new System.Exception("Not yours. Access Denied"); } if (_repo.Delete(id)) { return("Deleted successfully"); } return("Not Deleted"); }
internal string Delete(int id, string userId) { Keep data = _repo.FindById(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"); }
public string Delete(int id) { return(_repo.Delete(id)); }