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

            model.RoleId = role.RoleId;
            model.Name   = role.Name;
            return(model);
        }