public async Task <IHttpActionResult> Putcheck_points(int id, check_points check_points) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != check_points.id) { return(BadRequest()); } db.Entry(check_points).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!check_pointsExists(id)) { return(NotFound()); } else { throw; } } Logger.CreateLog(HttpContext.Current.Request.Url.PathAndQuery, HttpMethod.Put.Method, null); return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getcheck_points(int id) { check_points check_points = await db.check_points.FindAsync(id); if (check_points == null) { return(NotFound()); } Logger.CreateLog(HttpContext.Current.Request.Url.PathAndQuery, HttpMethod.Get.Method, null); return(Ok(check_points)); }
public async Task <IHttpActionResult> Postcheck_points(check_points check_points) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.check_points.Add(check_points); await db.SaveChangesAsync(); Logger.CreateLog(HttpContext.Current.Request.Url.PathAndQuery, HttpMethod.Post.Method, null); return(CreatedAtRoute("DefaultApi", new { id = check_points.id }, check_points)); }
public async Task <IHttpActionResult> Deletecheck_points(int id) { check_points check_points = await db.check_points.FindAsync(id); if (check_points == null) { return(NotFound()); } db.check_points.Remove(check_points); await db.SaveChangesAsync(); Logger.CreateLog(HttpContext.Current.Request.Url.PathAndQuery, HttpMethod.Delete.Method, null); return(Ok(check_points)); }