public HttpResponseMessage Post(WebBFKSRegistration registration) { if (!ModelState.IsValid || registration == null) { return Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } try { int id = repo.addBFKSRegistration(registration); return Request.CreateResponse(HttpStatusCode.Created, id); } catch (Exception e) { return Request.CreateResponse(HttpStatusCode.BadRequest, e); } }
public HttpResponseMessage Put(int id, WebBFKSRegistration registration) { if (!ModelState.IsValid || registration == null || id != registration.id) { return Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } try { repo.updateBFKSRegistration(registration); return Request.CreateResponse(HttpStatusCode.OK); } catch (Exception e) { return Request.CreateResponse(HttpStatusCode.BadRequest, e); } }