public ActionResult <string> Put([FromBody] Keep value) { int result = _keepRepo.EditKeep(value); if (result == 1) { return(Ok("Keep")); } return(BadRequest("FAIL")); }
public ActionResult <Keep> Put([FromBody] Keep newKeep) { Keep result = _kr.EditKeep(newKeep); if (result != null) { return(result); } return(BadRequest("Could not edit keep")); }
public ActionResult <Keep> Edit(int id, [FromBody] Keep editedKeep) { editedKeep.UserId = HttpContext.User.Identity.Name; Keep updatedKeep = _pr.EditKeep(editedKeep); if (updatedKeep == null) { return(BadRequest("Failed to edit keep")); } return(Ok(updatedKeep)); }
public ActionResult <string> Put(int keepId, [FromBody] Keep keep) { try { _repo.EditKeep(keep); return(Ok("Keep Updated")); } catch (Exception e) { return(BadRequest("Cannot edit keep")); } }
public ActionResult <Keep> EditKeep([FromBody] Keep keep) { //dangerous; we should use the repo(?) to also verify that the keep being editted is actually the user's keep? from here they could "steal" a keep, but not give it to someone else var id = HttpContext.User.FindFirstValue("Id"); var user = _userRepo.GetUserById(id); if (user != null && keep.userId == id) { return(Ok(_keepRepo.EditKeep(keep))); } return(BadRequest()); }
public Keep Put(int id, [FromBody] Keep keep) { return(_repo.EditKeep(id, keep)); }