Ejemplo n.º 1
0
        public ActionResult Edit(string id = null, string Category=null)
        {
            ModelCategory model = new ModelCategory();

            if (string.IsNullOrWhiteSpace(id))
            {
                model.Parentcateg = Category;
                ViewBag.Categorys = base.QueryCategoryAll(string.IsNullOrWhiteSpace(Category) ? null : Category);
                return View(model);
            }
            else
            {
                var idx = 0;
                int.TryParse(id, out idx);
                var resultMsg = string.Empty;
                LogicCategory logic = new LogicCategory();
                model = logic.CategoryDetail(out resultMsg, idx);
                if (model != null && string.IsNullOrWhiteSpace(model.Parentcateg)==false)
                {
                    ViewBag.Categorys = base.QueryCategoryAll(model.Parentcateg.ToString());
                }
                else
                {
                    ViewBag.Categorys = base.QueryCategoryAll();
                }

                if (resultMsg.Contains(BaseDict.ErrorPrefix))
                {
                    ViewBag.CustomScript = UtilityScript.ShowMessage(resultMsg, isCreate: true, isSuccess: true);
                }
                return View(model);
            }
        }
Ejemplo n.º 2
0
 public void CategoryDetailTest()
 {
     var resultMsg = string.Empty;
     LogicCategory logic = new LogicCategory();
     var model = logic.CategoryDetail(out resultMsg, 2);
     ModelCategory model1 = null;
     Assert.AreNotEqual(model, model1);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 查询分类实体
 /// </summary>
 /// <param name="Id"></param>
 /// <returns></returns>
 private ModelCategory GetCategoryDetail(string Id)
 {
     var resultMsg = string.Empty;
     var idx = 0;
     var logic = new LogicCategory();
     int.TryParse(Id, out idx);
     var model = logic.CategoryDetail(out resultMsg, idx);
     return model;
 }