コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }