public LoginWorkerResponse Login(LoginWorkerRequest request) { try { var workerToUpdate = _workerRepository.FindBy(worker => worker.Badge == request.Badge).FirstOrDefault(); workerToUpdate.ThrowExceptionIfIsNull(HttpStatusCode.Unauthorized, "Credenciales invalidas"); workerToUpdate.Login(); _hmacHelper.UpdateHmacOfWorker(workerToUpdate); return(new LoginWorkerResponse { WorkerId = workerToUpdate.Id, PublicKey = workerToUpdate.PublicKey }); } catch (DataAccessException) { throw new ApplicationException(); } }
public LoginWorkerResponse Login(LoginWorkerRequest request) { return(_workerService.Login(request)); }