public IHttpActionResult PutpayCheckModel(int id, payCheckModel payCheckModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != payCheckModel.Id) { return(BadRequest()); } db.Entry(payCheckModel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!payCheckModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetpayCheckModel(int id) { payCheckModel payCheckModel = db.PayCheck.Find(id); if (payCheckModel == null) { return(NotFound()); } return(Ok(payCheckModel)); }
public IHttpActionResult PostpayCheckModel(payCheckModel payCheckModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PayCheck.Add(payCheckModel); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = payCheckModel.Id }, payCheckModel)); }
public IHttpActionResult DeletepayCheckModel(int id) { payCheckModel payCheckModel = db.PayCheck.Find(id); if (payCheckModel == null) { return(NotFound()); } db.PayCheck.Remove(payCheckModel); db.SaveChanges(); return(Ok(payCheckModel)); }