Ejemplo n.º 1
0
        public ActionResult Details(System.Int64 id)
        {
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
            {
                return(RedirectToAction("NoPermission", "Error"));
            }
            Z01Product entity = Z01ProductHelper.Create(db, id);

            return(View(entity));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(System.Int64?id, string act)
        {
            Z01Product entity         = null;
            long       defaultBrandID = 0;

            if (id.HasValue && id > 0)
            {
                if (act == "detail")
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
                    {
                        return(RedirectToAction("NoPermission", "Error"));
                    }
                    ViewData["VTitle"]   = "查看产品信息";
                    ViewData["IsDetail"] = true;
                }
                else
                {
                    if ((_crud & Zippy.SaaS.Entity.CRUD.Update) != Zippy.SaaS.Entity.CRUD.Update)
                    {
                        return(RedirectToAction("NoPermission", "Error"));
                    }
                    ViewData["VTitle"] = "修改产品信息";
                }
                entity         = Z01ProductHelper.Create(db, id.Value);
                defaultBrandID = entity.BrandID ?? 0;
            }
            else
            {
                if ((_crud & Zippy.SaaS.Entity.CRUD.Create) != Zippy.SaaS.Entity.CRUD.Create)
                {
                    return(RedirectToAction("NoPermission", "Error"));
                }
                ViewData["VTitle"] = "新增产品";
                entity             = new Z01Product();
                try
                {
                    defaultBrandID = Request.Cookies["defaultBrandID"].Value.ToInt64();
                }
                catch { }
            }
            ViewData["UnitIDOptions"]  = Z01ProductHelper.GetUnitIDEntitiesHtmlOption(db, _tenant.TenantID.Value, entity.UnitID);
            ViewData["BrandIDOptions"] = Z01ProductHelper.GetBrandIDEntitiesHtmlOption(db, _tenant.TenantID.Value, defaultBrandID);
            ViewData["MoneyOptions"]   = EAP.Logic.Bus.HtmlHelper.CurrencySelectOptions(db);

            string returnUrl = Request["ReturnUrl"];

            if (returnUrl.IsNullOrEmpty())
            {
                returnUrl = "/" + _ContollerName;
            }
            ViewData["ReturnUrl"] = returnUrl;
            return(View(entity));
        }