Example #1
0
        public ActionResult Add(ModuleElementEdit moduleElementEdit)
        {
            ModuleElement moduleElement = Mapper.Map <ModuleElement>(moduleElementEdit);

            moduleElement = ModuleElementServices.AddEntity(moduleElement);
            return(Ok(new Result <int>
            {
                State = 1,
                Message = "添加成功",
                Data = moduleElement.ID
            }));
        }
 public ActionResult Add(ModuleElementEdit moduleElementEdit)
 {
     if (ModelState.IsValid)
     {
         ModuleElement moduleElement = Mapper.Map <ModuleElement>(moduleElementEdit);
         ModuleElementServices.AddEntity(moduleElement);
         return(Json(new Result <int>
         {
             State = 1,
             Message = "添加成功",
             Data = moduleElement.ID
         }));
     }
     else
     {
         IEnumerable <object> errors = ModelStateToJson();
         return(Json(new Result <object>
         {
             State = 0,
             Message = "错误",
             Data = errors
         }));
     }
 }