public ActionResult Operation(MpMenuLocationDetailsInfo info, string rtype) { if (string.IsNullOrWhiteSpace(info.Name)) { throw new Exception("菜单名称不能为空"); } if (string.IsNullOrWhiteSpace(rtype)) { throw new Exception("请选择菜单内容"); } if (rtype == "type_msg") { if (info.CategoryIds == null || info.CategoryIds.Count() == 0) { throw new Exception("请选择关联栏目"); } if (info.CategoryIds.Count() > 5) { throw new Exception("最多只能关联5个栏目"); } } else if (rtype == "type_view") { if (string.IsNullOrWhiteSpace(info.Url)) { throw new Exception("跳转URL不能为空"); } } var isEdit = info.Id.HasValue; if (info.CategoryIds != null && info.CategoryIds.GetEnumerator().MoveNext()) { info.Key = "cate_list"; } if (isEdit) { MpMenuDAL.Instance.Edit(info); } else { info.Id = MpMenuDAL.Instance.Add(info); } var re = MpMenuDAL.Instance.Get(info.Id.Value); return(JsonContent(re)); }
public ActionResult Operation(long?pid, long?id) { var model = new MpMenuLocationDetailsInfo() { ParentId = pid }; if (id.HasValue) { model = MpMenuDAL.Instance.GetDetails(id.Value); } ViewBag.CategoryList = CategoryDAL.Instance.GetList(); return(View(model)); }