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); } }
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); }
/// <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; }