public async Task <Response> Handle(Request request, CancellationToken cancellationToken) { return(new Response() { Roles = await _context.Roles.Select(x => RoleApiModel.FromRole(x)).ToListAsync() }); }
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) { return(new Response() { Role = RoleApiModel.FromRole(await _context.Roles.FindAsync(request.Id)) }); }
public static RoleApiModel FromRole(Role role) { var model = new RoleApiModel(); model.RoleId = role.RoleId; model.Name = role.Name; return(model); }