Ejemplo n.º 1
0
        public IHttpActionResult PostWeightCheck(WeightCheck weightCheck)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.WeightCheck.Add(weightCheck);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (WeightCheckExists(weightCheck.ProcessOrderNo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = weightCheck.ProcessOrderNo }, weightCheck));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PutWeightCheck(int id, WeightCheck weightCheck)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != weightCheck.ProcessOrderNo)
            {
                return(BadRequest());
            }

            db.Entry(weightCheck).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WeightCheckExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public IHttpActionResult GetWeightCheck(int id)
        {
            WeightCheck weightCheck = db.WeightCheck.Find(id);

            if (weightCheck == null)
            {
                return(NotFound());
            }

            return(Ok(weightCheck));
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeleteWeightCheck(int id)
        {
            WeightCheck weightCheck = db.WeightCheck.Find(id);

            if (weightCheck == null)
            {
                return(NotFound());
            }

            db.WeightCheck.Remove(weightCheck);
            db.SaveChanges();

            return(Ok(weightCheck));
        }