Exemplo n.º 1
0
 public ActionResult ChinhSua(MaLoaiSanPham ncc)
 {
     db.MaLoaiSanPhams.Add(ncc);
     db.Entry(ncc).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 2
0
        public ActionResult Xoa(int?IdMLSP)
        {
            if (IdMLSP == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            MaLoaiSanPham nsx = db.MaLoaiSanPhams.SingleOrDefault(n => n.IdMLSP == IdMLSP);

            if (nsx == null)
            {
                return(HttpNotFound());
            }
            return(View(nsx));;
        }
Exemplo n.º 3
0
        public ActionResult Xoa(int IdMLSP)
        {
            if (IdMLSP == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MaLoaiSanPham nsx = db.MaLoaiSanPhams.SingleOrDefault(n => n.IdMLSP == IdMLSP);

            if (nsx == null)
            {
                return(HttpNotFound());
            }
            db.MaLoaiSanPhams.Remove(nsx);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public ActionResult TaoMoi(MaLoaiSanPham mlsp)
 {
     db.MaLoaiSanPhams.Add(mlsp);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }