Example #1
0
        public IHttpActionResult Posttsaleorderdtl(tsaleorderdtl tsaleorderdtl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tsaleorderdtl.Add(tsaleorderdtl);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (tsaleorderdtlExists(tsaleorderdtl.SaleOrderNO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tsaleorderdtl.SaleOrderNO }, tsaleorderdtl));
        }
Example #2
0
        public IHttpActionResult Puttsaleorderdtl(string id, tsaleorderdtl tsaleorderdtl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult Gettsaleorderdtl(string id)
        {
            tsaleorderdtl tsaleorderdtl = db.tsaleorderdtl.Find(id);

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

            return(Ok(tsaleorderdtl));
        }
Example #4
0
        public IHttpActionResult Deletetsaleorderdtl(string id)
        {
            tsaleorderdtl tsaleorderdtl = db.tsaleorderdtl.Find(id);

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

            db.tsaleorderdtl.Remove(tsaleorderdtl);
            db.SaveChanges();

            return(Ok(tsaleorderdtl));
        }