public async Task <IActionResult> Update([FromBody] InterpreterDetailsModel interpreter) { if (interpreter == null) { return(ReturnError(ErrorCodes.IncomingPayloadIsMissing)); } try { var brokerId = User.TryGetBrokerId().Value; if (EnumHelper.GetEnumByCustomName <InterpreterInformationType>(interpreter.InterpreterInformationType) == InterpreterInformationType.NewInterpreter) { ReturnError(ErrorCodes.InterpreterFaultyIntention); } var updatedInterpreter = _apiUserService.GetInterpreter(interpreter, brokerId); await _dbContext.SaveChangesAsync(); var updatedInterpreterResponse = ApiUserService.GetModelFromEntity(updatedInterpreter); return(Ok(new UpdateInterpreterResponse { Interpreter = updatedInterpreterResponse })); } catch (InvalidApiCallException ex) { return(ReturnError(ex.ErrorCode)); } catch (Exception e) { _logger.LogError(e, $"Unexpected error occured when client called Request/{nameof(View)}"); return(ReturnError(ErrorCodes.UnspecifiedProblem)); } }
public ComplaintController( TolkDbContext tolkDbContext, ComplaintService complaintService, ApiUserService apiUserService, ApiOrderService apiOrderService, ILogger <ComplaintController> logger ) { _dbContext = tolkDbContext; _apiUserService = apiUserService; _complaintService = complaintService; _apiOrderService = apiOrderService; _logger = logger; }
public RequisitionController( TolkDbContext tolkDbContext, ILogger <RequisitionController> logger, RequisitionService requisitionService, ApiUserService apiUserService, ApiOrderService apiOrderService ) { _dbContext = tolkDbContext; _logger = logger; _apiUserService = apiUserService; _requisitionService = requisitionService; _apiOrderService = apiOrderService; }
public RequestGroupController( TolkDbContext tolkDbContext, RequestService requestService, ApiUserService apiUserService, ISwedishClock timeService, ApiOrderService apiOrderService, ILogger <RequestController> logger) { _dbContext = tolkDbContext; _apiUserService = apiUserService; _timeService = timeService; _requestService = requestService; _apiOrderService = apiOrderService; _logger = logger; }
public OrderController( TolkDbContext tolkDbContext, OrderService orderService, ApiOrderService apiOrderService, ApiUserService apiUserService, ITolkBaseOptions tolkBaseOptions, ILogger <OrderController> logger) { _dbContext = tolkDbContext; _orderService = orderService; _apiOrderService = apiOrderService; _tolkBaseOptions = tolkBaseOptions; _logger = logger; _apiUserService = apiUserService; }
public static string GetToken(string pUserName, string pPassword, string pUrl, string pBankId = "") { var loSmsModel = new ApiUserService { UserName = pUserName, Password = pPassword, ApiKey = pPassword, BankId = pBankId }; var client = new RestClient(pUrl); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.RequestFormat = DataFormat.Json; var loModel = JsonConvert.SerializeObject(loSmsModel); request.AddJsonBody(loModel); return(JsonConvert.DeserializeObject <GeneratedToken>(client.Execute(request).Content).token); }
public InterpreterController(TolkDbContext tolkDbContext, ApiUserService apiUserService, ILogger <InterpreterController> logger) { _dbContext = tolkDbContext; _apiUserService = apiUserService; _logger = logger; }
public CustomAuthHandler(IOptionsMonitor <CustomAuthOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, ApiUserService apiUserService) : base(options, logger, encoder, clock) { _apiUserService = apiUserService; }
public UsersController(ApiUserService userService) { _userService = userService; }