public ActionResult Edit(string id = null, string Category=null) { ModelCategory model = new ModelCategory(); if (string.IsNullOrWhiteSpace(id)) { model.Parentcateg = Category; model.Createdate = DateTime.Now; 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,base.AuthorizeInfo, 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); }