public ActionResult Add(RoleEdit roleEdit)
 {
     if (ModelState.IsValid)
     {
         Role role = Mapper.Map <Role>(roleEdit);
         //role.IsDelete = 0;
         RoleServices.AddEntity(role);
         return(Json(new Result <int>
         {
             State = 1,
             Message = "添加成功",
             Data = role.ID
         }));
     }
     else
     {
         IEnumerable <object> errors = ModelStateToJson();
         return(Json(new Result <object>
         {
             State = 0,
             Message = "错误",
             Data = errors
         }));
     }
 }
Exemplo n.º 2
0
        public ActionResult Add(RoleEdit roleEdit)
        {
            Role role = Mapper.Map <Role>(roleEdit);

            //role.IsDelete = 0;
            RoleServices.AddEntity(role);
            return(Ok(new Result <int>
            {
                State = 1,
                Message = "添加成功",
                Data = role.ID
            }));
        }