public ActionResult AjaxView()
        {
            var shopProductDetail = _api.GetItemById(UserItem.AgencyID, ArrId.FirstOrDefault());

            ViewData.Model = shopProductDetail;
            return(View());
        }
Exemple #2
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));
        }