Exemplo n.º 1
0
        public async Task <IActionResult> Log(LogInOutViewModel viewModel)
        {
            // Validate card no. & password
            var user = await _mediator.Send(new ValidateTimeInOut.Query(viewModel));

            if (user == null)
            {
                return(BadRequest(new ErrorHandler {
                    Description = "Invalid card no. or password."
                }));
            }

            // Broadcast to web client
            await _hubContext.Clients.All.SendAsync("employee-logged");

            // Return result with employee information
            return(new OkObjectResult(
                       await _mediator.Send(new RecordLog.Command(user))
                       ));
        }
Exemplo n.º 2
0
 public Query(LogInOutViewModel viewModel)
 {
     ViewModel = viewModel;
 }