Exemplo n.º 1
0
        public ActionResult AjaxForm()
        {
            var productId  = Convert.ToInt32(Request.QueryString["productId"]);
            var objProduct = _productDetailApi.GetItemById(UserItem.AgencyID, productId);
            var model      = new ProductItem();

            if (DoAction == ActionType.Edit)
            {
                model = _api.GetProductItem(ArrId.FirstOrDefault());
            }
            model.ColorID = model.ColorID.HasValue ? model.ColorID : 0;
            if (objProduct != null)
            {
                model.Name            = objProduct.Name;
                model.PriceNew        = objProduct.Price ?? 0;
                model.ProductDetailID = objProduct.ID;
            }
            ViewBag.ColorID = _systemColorApi.GetAll(UserItem.AgencyID);
            if (model.UnitID != null)
            {
                ViewBag.SizeID = _productSizeApi.GetAllByUnitID(UserItem.AgencyID, model.UnitID ?? 0);
            }
            else
            {
                ViewBag.SizeID = _productSizeApi.GetAll(UserItem.AgencyID);
            }
            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            ViewBag.Unit       = _dnUnit.GetListUnit(UserItem.AgencyID);
            ViewBag.type       = _productTypeApi.GetAll();
            ViewBag.Color      = _productTypeApi.GetAll();
            ViewBag.CreateBy   = UserItem.UserName;
            ViewBag.AgencyID   = UserItem.AgencyID;
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult AjaxFormAdd()
        {
            var productId = Convert.ToInt32(Request.QueryString["productId"]);
            var model     = _api.GetItemById(UserItem.AgencyID, productId);

            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            ViewBag.listcolor  = _colorDa.GetAll(2010);
            ViewBag.listSize   = _productSizeApi.GetAllByUnitID(UserItem.AgencyID, model.UnitID);
            ViewBag.listType   = _productTypeDa.GetAll();
            return(View(model));
        }