Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SPGIAMGIA sPGIAMGIA = db.SPGIAMGIAs.Find(id);

            db.SPGIAMGIAs.Remove(sPGIAMGIA);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "ID_KM,ID_SP,soluong,giaht,ngayban")] SPGIAMGIA sPGIAMGIA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPGIAMGIA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_SP = new SelectList(db.SANPHAMs, "ID_SP", "tensanpham", sPGIAMGIA.ID_SP);
     return(View(sPGIAMGIA));
 }
Beispiel #3
0
        public int Delete(SPGIAMGIA model)
        {
            SPGIAMGIA dbEntry = context.SPGIAMGIAs.Find(model.ID_KM);

            if (dbEntry != null)
            {
                context.SPGIAMGIAs.Remove(dbEntry);
                context.SaveChanges();
            }
            return(model.ID_KM);
        }
Beispiel #4
0
        public int Insert(SPGIAMGIA model)
        {
            SPGIAMGIA dbEntry = context.SPGIAMGIAs.Find(model.ID_KM);

            if (dbEntry != null)
            {
                return(-1);
            }
            context.SPGIAMGIAs.Add(model);
            context.SaveChanges();
            return(model.ID_SP);
        }
Beispiel #5
0
        // GET: Admin/SPGIAMGIA/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SPGIAMGIA sPGIAMGIA = db.SPGIAMGIAs.Find(id);

            if (sPGIAMGIA == null)
            {
                return(HttpNotFound());
            }
            return(View(sPGIAMGIA));
        }
Beispiel #6
0
        // GET: Admin/SPGIAMGIA/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SPGIAMGIA sPGIAMGIA = db.SPGIAMGIAs.Find(id);

            if (sPGIAMGIA == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ID_SP = new SelectList(db.SANPHAMs, "ID_SP", "tensanpham", sPGIAMGIA.ID_SP);
            return(View(sPGIAMGIA));
        }
Beispiel #7
0
        public int Update(SPGIAMGIA model)
        {
            SPGIAMGIA dbEntry = context.SPGIAMGIAs.Find(model.ID_KM);

            if (dbEntry == null)
            {
                return(-1);
            }
            dbEntry.ID_SP   = model.ID_SP;
            dbEntry.soluong = model.soluong;
            //dbEntry.ID_SP = model.ID_SP;
            dbEntry.giaht   = model.giaht;
            dbEntry.ngayban = model.ngayban;
            context.SaveChanges();
            return(model.ID_KM);
        }
Beispiel #8
0
        public SPGIAMGIA FindEntity(int Mahang)
        {
            SPGIAMGIA dbEntry = context.SPGIAMGIAs.Find(Mahang);

            return(dbEntry);
        }