public ActionResult Update(int math)
        {
            THUONGHIEU            thuonghieu = productBrandService.getProductBrandById(math);
            ProductBrandViewModel th         = new ProductBrandViewModel();

            th.MATH      = math;
            th.TENTH     = thuonghieu.TENTH;
            th.HINHTH    = thuonghieu.HINHTH;
            ViewBag.MATH = thuonghieu.HINHTH;
            return(View(th));
        }
        public ActionResult Create(ProductBrandViewModel th)
        {
            ViewBag.message = "";
            if (ModelState.IsValid)
            {
                THUONGHIEU thuonghieu = new THUONGHIEU();
                thuonghieu.TENTH  = th.TENTH;
                thuonghieu.HINHTH = th.HINHTH;

                if (productBrandService.addProductBrand(thuonghieu))
                {
                    ViewBag.message = "Thêm mới thương hiệu thành công";
                }
            }
            return(View(th));
        }
Exemple #3
0
 public IEnumerable <ProductBrandViewModel> GetProductBrands(string getBrands)
 {
     try
     {
         IList <productbrand>          productBrands = productBrandRepository.GetAll().ToList <productbrand>();
         IList <ProductBrandViewModel> vms           = new List <ProductBrandViewModel>();
         foreach (productbrand item in productBrands)
         {
             ProductBrandViewModel vm = new ProductBrandViewModel();
             vm.productbrandid   = item.productbrandid;
             vm.productbrandname = item.productbrandname;
             vms.Add(vm);
         }
         return(vms);
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public ActionResult Create()
        {
            ProductBrandViewModel th = new ProductBrandViewModel();

            return(View(th));
        }