Exemple #1
0
        public override ActionResult Delete(int id)
        {
            EntityActionResult result = _helper.Delete(id);
            var message = result.Success ? _modelname + " has been deleted" : result.Message;

            if (!result.Success)
            {
                return(Json(new { Success = result.Success, Message = message }, JsonRequestBehavior.AllowGet));
            }

            var items = MenuEntry.Find(Query <MenuEntry> .New().Where(m => m.RefId).Is(id));

            if (items != null && items.Count > 0)
            {
                var item = items[0];
                MenuEntry.Delete(item);
            }
            return(Json(new { Success = result.Success, Message = message }, JsonRequestBehavior.AllowGet));
        }