public IHttpActionResult Patch(ProjectViewModel model) { if (model.id < 0) { return(BadRequest()); } var svc = new ProjectAppSvcGeneric(); var toUpdate = svc.Get(model.id.Value); if (toUpdate == null) { return(NotFound()); } try { toUpdate.ProjectName = model.projectName; var result = svc.Update(toUpdate); return(Ok(result)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Get(int id) { if (id < 0) { return(BadRequest()); } var svc = new ProjectAppSvcGeneric(); var customer = svc.Get(id); if (customer == null) { return(NotFound()); } return(Ok(customer)); }
public IHttpActionResult Delete(int id) { if (id < 0) { return(BadRequest()); } var svc = new ProjectAppSvcGeneric(); var project = svc.Get(id); if (project == null) { return(NotFound()); } var result = svc.Delete(id); return(result ? StatusCode(HttpStatusCode.NoContent) : StatusCode(HttpStatusCode.InternalServerError)); }