public static BehaviourTypeApiModel FromBehaviourType(BehaviourType behaviourType) { var model = new BehaviourTypeApiModel(); model.BehaviourTypeId = behaviourType.BehaviourTypeId; model.Name = behaviourType.Name; return(model); }
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { BehaviourTypes = await _context.BehaviourTypes.Select(x => BehaviourTypeApiModel.FromBehaviourType(x)).ToListAsync() };
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { BehaviourType = BehaviourTypeApiModel.FromBehaviourType(await _context.BehaviourTypes.FindAsync(request.BehaviourTypeId)) };