public SysRole Create(RoleCreateApiModel created, int userId) { var role = new SysRole { Name = created.Name, CreateUserId = userId, CreateTime = DateTime.UtcNow }; using (var tran = _context.Database.BeginTransaction()) { _context.SysRole.Add(role); _context.SaveChanges(); if (created.MenuIds != null && created.MenuIds.Any()) { _context.SysPrivilege.AddRange(created.MenuIds.Select(x => new SysPrivilege { MenuId = x, RoleId = role.Id, })); _context.SaveChanges(); } tran.Commit(); } return(role); }
public SysRole Create(RoleCreateApiModel created, int userId) { return(_roleContext.Create(created, userId)); }
public JsonResult Post(RoleCreateApiModel created) { var data = _roleService.Create(created, UserId); return(Json(data)); }
public SysRole Create(RoleCreateApiModel created, int userId) { return(_sysRoleRespository.Create(created, userId)); }