Ejemplo n.º 1
0
        public async Task <AjaxResult> EditRoleAsync(Role role)
        {
            var user = HttpContextCore.GetLoginUser(_accessor);

            if (string.IsNullOrWhiteSpace(role.Id))
            {
                role.Id = Guid.NewGuid().ToString("N").ToUpper();
                role.Create(user.UserId, user.UserName);

                await _dal.AddAsync(role);

                return(Success("添加成功"));
            }
            else
            {
                role.Update(user.UserId, user.UserName);

                await _dal.EditAsync(role);

                return(Success("修改成功"));
            }
        }