Beispiel #1
0
 public ApiResult <bool> Add(Role model)
 {
     using (roleDal)
     {
         return(roleDal.Add(model));
     }
 }
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="role">角色信息</param>
        /// <param name="user">用户信息</param>
        /// <returns>是否注册成功</returns>
        public bool Register(Role role, UserInfo user)
        {
            RoleDal roleDal = new RoleDal();

            if (roleDal.Add(ref role))
            {
                role        = roleDal.GetRole(role.userNum);
                user.userId = role.id;
                return(new UserInfoDal().Add(user));
            }
            else
            {
                throw new Exception("注册失败!");
            }
        }
Beispiel #3
0
 public IActionResult Add(RoleAddModel model)
 {
     try
     {
         var p = new RoleDefinition()
         {
             RoleId = Guid.NewGuid().ToString("N"),
             Name   = model.Name,
         };
         RoleDal.Add(p);
         return(Json(1));
     }
     catch (Exception ex)
     {
         return(Json(ex.Message));
     }
 }
Beispiel #4
0
 //增加
 public int Add(RoleModel role)
 {
     //调用DAL层的add方法并返回
     return(dal.Add(role));
 }
Beispiel #5
0
 public override void Add(Role bean)
 {
     _roleDal.Add(bean);
 }