public ActionResult <string> Delete(int id) { bool successful = _kr.Delete(id); if (!successful) { return(BadRequest("No Delete")); } return(Ok()); }
public bool Delete([FromBody] Keep keep) { if (HttpContext.User.Identity.Name != keep.UserId) { throw new Exception("Cannot delete other's keeps!"); } bool deleted = _repo.Delete(keep); return(deleted); }
public ActionResult <String> Delete(int id) { try { return(Ok(_repo.Delete(id))); } catch (Exception e) { return(BadRequest(e)); } }
public void Delete([FromBody] KeepDiscard keep) { if (keep.UserId == HttpContext.User.Identity.Name && keep.IsPrivate == 1) { _repo.Delete(keep.Id); } else { throw new Exception("Not authorized to delete public keeps"); } }
public ActionResult <string> Delete(int id) { var userId = HttpContext.User.Identity.Name; bool successful = _kr.Delete(id, userId); if (!successful) { return(BadRequest()); } return(Ok()); }
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) { try { var userId = HttpContext.User.FindFirstValue("Id"); return(_Repo.Delete(id, userId)); } catch (Exception e) { return($"Error Message{e.Message}"); } }
public bool Delete([FromRoute] int id) { string UserId = HttpContext.User.Identity.Name; return(_repo.Delete(id, UserId)); }