public ActionResult <string> EditKeep([FromBody] Keep value) { int result = _repo.EditKeep(value); if (result == 1) { return(Ok("success")); } return(BadRequest("Unsuccessful edit")); }
public ActionResult <Keep> Update(int id, [FromBody] Keep editedKeep) { Keep updatedKeep = _kr.EditKeep(id, editedKeep); if (updatedKeep == null) { return(BadRequest()); } return(Ok(updatedKeep)); }
internal Keep EditKeep(Profile userInfo, Keep editedKeep) { Keep oldKeep = _repo.GetKeepById(editedKeep.Id); if (oldKeep == null) { throw new Exception("Bad Id"); } if (oldKeep.CreatorId != userInfo.Id) { throw new Exception("You are not the original poster of the Keep"); } _repo.EditKeep(editedKeep); return(_repo.GetKeepById(editedKeep.Id)); }
public string Put(int id, [FromBody] Keeps keep) { db.EditKeep(keep); return("Updated"); }
public void EditKeep([FromBody] Keep aKeep) { db.EditKeep(aKeep); }