Exemplo n.º 1
0
        public IHttpActionResult PostCCTC_MO_HINH_CONG_TY(CCTC_MO_HINH_CONG_TY cCTC_MO_HINH_CONG_TY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CCTC_MO_HINH_CONG_TY.Add(cCTC_MO_HINH_CONG_TY);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CCTC_MO_HINH_CONG_TYExists(cCTC_MO_HINH_CONG_TY.MA_MO_HINH))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = cCTC_MO_HINH_CONG_TY.MA_MO_HINH }, cCTC_MO_HINH_CONG_TY));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutCCTC_MO_HINH_CONG_TY(string id, CCTC_MO_HINH_CONG_TY cCTC_MO_HINH_CONG_TY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetCCTC_MO_HINH_CONG_TY(string id)
        {
            CCTC_MO_HINH_CONG_TY cCTC_MO_HINH_CONG_TY = db.CCTC_MO_HINH_CONG_TY.Find(id);

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

            return(Ok(cCTC_MO_HINH_CONG_TY));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteCCTC_MO_HINH_CONG_TY(string id)
        {
            CCTC_MO_HINH_CONG_TY cCTC_MO_HINH_CONG_TY = db.CCTC_MO_HINH_CONG_TY.Find(id);

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

            db.CCTC_MO_HINH_CONG_TY.Remove(cCTC_MO_HINH_CONG_TY);
            db.SaveChanges();

            return(Ok(cCTC_MO_HINH_CONG_TY));
        }