Example #1
0
        public async Task <IHttpActionResult> PostTbl_ImageDonNhapHang(Tbl_ImageDonNhapHang tbl_ImageDonNhapHang)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Tbl_ImageDonNhapHang.Add(tbl_ImageDonNhapHang);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (Tbl_ImageDonNhapHangExists(tbl_ImageDonNhapHang.IDNH_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tbl_ImageDonNhapHang.IDNH_ID }, tbl_ImageDonNhapHang));
        }
Example #2
0
        public async Task <IHttpActionResult> PutTbl_ImageDonNhapHang(string id, Tbl_ImageDonNhapHang tbl_ImageDonNhapHang)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public async Task <IHttpActionResult> GetTbl_ImageDonNhapHang(string id)
        {
            Tbl_ImageDonNhapHang tbl_ImageDonNhapHang = await db.Tbl_ImageDonNhapHang.FindAsync(id);

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

            return(Ok(tbl_ImageDonNhapHang));
        }
Example #4
0
        public async Task <IHttpActionResult> DeleteTbl_ImageDonNhapHang(string id)
        {
            Tbl_ImageDonNhapHang tbl_ImageDonNhapHang = await db.Tbl_ImageDonNhapHang.FindAsync(id);

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

            db.Tbl_ImageDonNhapHang.Remove(tbl_ImageDonNhapHang);
            await db.SaveChangesAsync();

            return(Ok(tbl_ImageDonNhapHang));
        }