public void Edit([FromBody] Camp Camp) { if (ModelState.IsValid) { objCamp.UpdateCamp(Camp); } }
public HttpResponseMessage UpdateCamp(int id, [FromBody] CampDTO camp) { try { if (id <= 0) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Not a valid camp id")); } else if (Icamp.UpdateCamp(id, camp) == false) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No camp found with id " + id.ToString())); } else { Icamp.UpdateCamp(id, camp); return(Request.CreateResponse(HttpStatusCode.OK, "1 row affected")); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }