Esempio n. 1
0
        public bool Delete(string ma)
        {
            tbl_NCC tbl = db.tbl_NCC.Find(ma);

            db.tbl_NCC.Remove(tbl);
            db.SaveChanges();
            return(true);
        }
Esempio n. 2
0
        public long Create(tbl_NCC ncc)
        {
            ncc.dNgayTao = DateTime.Now;
            db.tbl_NCC.Add(ncc);
            db.SaveChanges();
            //tags
            //lay danh sach tag


            return(ncc.IDncc);
        }
 public ActionResult Create(tbl_NCC model)
 {
     if (ModelState.IsValid)
     {
         var session = (UserLogin)Session[CommonConstants.USER_SESSION];
         model.sNguoiTao = session.UserName;
         new NhaCungCapDAO().Create(model);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
        public ActionResult Edit(tbl_NCC model, FormCollection formcollection)
        {
            if (ModelState.IsValid)
            {
                //var dao = new SanPhamDAO();
                long id      = long.Parse(formcollection["hdnID"]);
                var  session = (UserLogin)Session[CommonConstants.USER_SESSION];
                model.sNguoiTao = session.UserName;
                model.IDncc     = id;
                //var result = dao.Edit(model);
                new NhaCungCapDAO().Edit(model);

                return(RedirectToAction("Index"));
            }


            return(View());
        }
Esempio n. 5
0
        public bool Edit(tbl_NCC ncc)
        {
            try
            {
                var addcontent = db.tbl_NCC.Find(ncc.IDncc);
                addcontent.sTenNCC = ncc.sTenNCC;
                addcontent.sEmail  = ncc.sEmail;
                addcontent.sSDT    = ncc.sSDT;
                addcontent.sDiaChi = ncc.sDiaChi;
                addcontent.bStatus = ncc.bStatus;
                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 6
0
 public bool Update(ProviderModel model)
 {
     try
     {
         tbl_NCC tbl = db.tbl_NCC.Find(model.Ma_NCC);
         tbl.Ten_NCC  = model.Ten_NCC;
         tbl.Dia_Chi  = model.Dia_Chi;
         tbl.Tel      = model.Tel;
         tbl.Fax      = model.Fax;
         tbl.Attn     = model.Attn;
         tbl.Email    = model.Email;
         tbl.Hang_Hoa = model.Hang_Hoa;
         tbl.Dich_Vu  = model.Dich_Vu;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }