コード例 #1
0
 public ActionResult Edit(Menu obj)
 {
     if (string.IsNullOrEmpty(obj.Name))
     {
         return(Json(false, JsonRequestBehavior.AllowGet));
     }
     else
     {
         Menu model = MenuBLL.GetById(obj.Id);
         if (model == null)
         {
             return(Json(false, JsonRequestBehavior.AllowGet));
         }
         else
         {
             model.Name      = obj.Name;
             model.ShowOrder = obj.ShowOrder;
             UrlRecord url = UrlBLL.Table.FirstOrDefault(o => o.EntityName == "Menu" && o.EntityId == obj.Id);
             url.Slug = obj.ValidateSeName("", obj.Name, true);
             UrlBLL.Update(url);
             MenuBLL.Update(model);
             CacheManager.Remove(Consts.MenuCacheKey);
             CacheManager.Remove(Consts.UrlRecordCacheKey);
             return(Json(true, JsonRequestBehavior.AllowGet));
         }
     }
 }
コード例 #2
0
        public ActionResult Delete(Guid id)
        {
            Menu      obj       = MenuBLL.GetById(id);
            UrlRecord urlRecord = UrlBLL.Table.FirstOrDefault(o => o.EntityName == "Menu" && o.EntityId == obj.Id);

            if (urlRecord != null)
            {
                UrlBLL.Delete(urlRecord);
            }
            MenuBLL.Delete(obj);
            CacheManager.Remove(Consts.MenuCacheKey);
            CacheManager.Remove(Consts.UrlRecordCacheKey);
            return(Json(true, JsonRequestBehavior.AllowGet));
        }