Пример #1
0
        public JsonResult Save(SysFunctionDTO.SaveModel model)
        {
            AjaxResult js = new AjaxResult();

            if (!ModelState.IsValid)
            {
                return(ModelState.GetFirstErrorMessageResult());
            }

            if (model.Id == 0)
            {
                model.Source.Create  = DateTime.Now;
                model.Source.IsValid = 1;
                model.Source.UserId  = 1;
                sysfunctionPrivoder.Add(model.Source);
            }
            else
            {
                sysfunctionPrivoder.Update(c => c.Id == model.Id, c => new SysFunctionInfo()
                {
                    Name       = model.Name,
                    Style      = model.Style,
                    Area       = model.Area,
                    Action     = model.Action,
                    Controller = model.Controller,
                    IsMenu     = model.Source.IsMenu
                });
            }
            js.Success = true;
            js.Message = "操作成功";
            return(Json(js));
        }
Пример #2
0
        public JsonResult GetOne(int id)
        {
            var entity = sysfunctionPrivoder.Single(c => c.Id == id);

            SysFunctionDTO.SaveModel model = new SysFunctionDTO.SaveModel()
            {
                Source = entity
            };
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
 public JsonResult GetOne(int id)
 {
     var entity = sysfunctionPrivoder.Single(c => c.Id == id);
     SysFunctionDTO.SaveModel model = new SysFunctionDTO.SaveModel()
     {
         Source = entity
     };
     return Json(model, JsonRequestBehavior.AllowGet);
 }