コード例 #1
0
        public IHttpActionResult Posttbl_DetailBaoCaoHinhAnh(tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tbl_DetailBaoCaoHinhAnh.Add(tbl_DetailBaoCaoHinhAnh);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (tbl_DetailBaoCaoHinhAnhExists(tbl_DetailBaoCaoHinhAnh.BCHA_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tbl_DetailBaoCaoHinhAnh.BCHA_ID }, tbl_DetailBaoCaoHinhAnh));
        }
コード例 #2
0
        public IHttpActionResult Puttbl_DetailBaoCaoHinhAnh(string id, tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult Gettbl_DetailBaoCaoHinhAnh(string id)
        {
            tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh = db.tbl_DetailBaoCaoHinhAnh.Find(id);

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

            return(Ok(tbl_DetailBaoCaoHinhAnh));
        }
コード例 #4
0
        public IHttpActionResult Deletetbl_DetailBaoCaoHinhAnh(string id)
        {
            tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh = db.tbl_DetailBaoCaoHinhAnh.Find(id);

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

            db.tbl_DetailBaoCaoHinhAnh.Remove(tbl_DetailBaoCaoHinhAnh);
            db.SaveChanges();

            return(Ok(tbl_DetailBaoCaoHinhAnh));
        }