Esempio n. 1
0
        public IHttpActionResult PutRetailInvoices(int id, Retail_Invoices retailInvoice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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


            db.Entry(retailInvoice).State = System.Data.Entity.EntityState.Modified;

            //date issue :SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
            try
            {
                db.SaveChanges();
            }

            catch (DbUpdateConcurrencyException)
            {
                if (!RetailInvoiceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> PutRetail_WebInfo(int id, Retail_WebInfo retail_WebInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(retail_WebInfo).State = System.Data.Entity.EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Retail_WebInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }