Example #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            DONGSANPHAM dONGSANPHAM = db.DONGSANPHAMs.Find(id);

            db.DONGSANPHAMs.Remove(dONGSANPHAM);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "DSP_ID,DSP_TEN,DSP_MOTA")] DONGSANPHAM dONGSANPHAM)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dONGSANPHAM).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dONGSANPHAM));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "DSP_ID,DSP_TEN,DSP_MOTA")] DONGSANPHAM dONGSANPHAM)
        {
            if (ModelState.IsValid)
            {
                dONGSANPHAM.DSP_ID = db.autottang("DongSanPham", "DSP_ID", db.DONGSANPHAMs.Count()).ToString();
                db.DONGSANPHAMs.Add(dONGSANPHAM);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dONGSANPHAM));
        }
Example #4
0
        // GET: DONGSANPHAMs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DONGSANPHAM dONGSANPHAM = db.DONGSANPHAMs.Find(id);

            if (dONGSANPHAM == null)
            {
                return(HttpNotFound());
            }
            return(View(dONGSANPHAM));
        }