예제 #1
0
        public IHttpActionResult PutsoldItemDetail(int id, soldItemDetail soldItemDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public IHttpActionResult GetsoldItemDetail(int id)
        {
            soldItemDetail soldItemDetail = db.soldItemDetails.Find(id);

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

            return(Ok(soldItemDetail));
        }
예제 #3
0
        public IHttpActionResult PostsoldItemDetail(soldItemDetail soldItemDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.soldItemDetails.Add(soldItemDetail);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = soldItemDetail.id }, soldItemDetail));
        }
예제 #4
0
        public IHttpActionResult DeletesoldItemDetail(int id)
        {
            soldItemDetail soldItemDetail = db.soldItemDetails.Find(id);

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

            db.soldItemDetails.Remove(soldItemDetail);
            db.SaveChanges();

            return(Ok(soldItemDetail));
        }