Ejemplo n.º 1
0
        public IHttpActionResult PostCN_NHOM_NGHIEP_VU(CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CN_NHOM_NGHIEP_VU.Add(cN_NHOM_NGHIEP_VU);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CN_NHOM_NGHIEP_VUExists(cN_NHOM_NGHIEP_VU.TEN_NHOM))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = cN_NHOM_NGHIEP_VU.TEN_NHOM }, cN_NHOM_NGHIEP_VU));
        }
        public IHttpActionResult PutCN_NHOM_NGHIEP_VU(int id, CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(string id)
        {
            CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU = db.CN_NHOM_NGHIEP_VU.Find(id);

            db.CN_NHOM_NGHIEP_VU.Remove(cN_NHOM_NGHIEP_VU);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IHttpActionResult GetCN_NHOM_NGHIEP_VU(int id)
        {
            CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU = db.CN_NHOM_NGHIEP_VU.Find(id);

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

            return(Ok(cN_NHOM_NGHIEP_VU));
        }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "TEN_NHOM,DIEN_GIAI,TRUC_THUOC")] CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cN_NHOM_NGHIEP_VU).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TRUC_THUOC = new SelectList(db.CCTC_CONG_TY, "MA_CONG_TY", "TEN_CONG_TY", cN_NHOM_NGHIEP_VU.TRUC_THUOC);
     return(View(cN_NHOM_NGHIEP_VU));
 }
        public IHttpActionResult PostCN_NHOM_NGHIEP_VU(CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CN_NHOM_NGHIEP_VU.Add(cN_NHOM_NGHIEP_VU);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = cN_NHOM_NGHIEP_VU.ID }, cN_NHOM_NGHIEP_VU));
        }
        public IHttpActionResult DeleteCN_NHOM_NGHIEP_VU(int id)
        {
            CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU = db.CN_NHOM_NGHIEP_VU.Find(id);

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

            db.CN_NHOM_NGHIEP_VU.Remove(cN_NHOM_NGHIEP_VU);
            db.SaveChanges();

            return(Ok(cN_NHOM_NGHIEP_VU));
        }
Ejemplo n.º 8
0
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU = db.CN_NHOM_NGHIEP_VU.Find(id);

            if (cN_NHOM_NGHIEP_VU == null)
            {
                return(HttpNotFound());
            }
            return(View(cN_NHOM_NGHIEP_VU));
        }
Ejemplo n.º 9
0
        // GET: CN_NHOM_NGHIEP_VU/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CN_NHOM_NGHIEP_VU cN_NHOM_NGHIEP_VU = db.CN_NHOM_NGHIEP_VU.Find(id);

            if (cN_NHOM_NGHIEP_VU == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TRUC_THUOC = new SelectList(db.CCTC_CONG_TY, "MA_CONG_TY", "TEN_CONG_TY", cN_NHOM_NGHIEP_VU.TRUC_THUOC);
            return(View(cN_NHOM_NGHIEP_VU));
        }