Esempio n. 1
0
        public async Task <IActionResult> CreateOrder([FromBody] CreateCreditCardOrderDto model)
        {
            var user = await _userService.GetFromIdentityAsync(User.Identity.Name);

            if (user.Status == DataHolderStatus.Unauthorized)
            {
                return(Unauthorized());
            }

            var createResult = await _creditCardService.CreateOrderAsync(model, user.Data);

            if (createResult.Status == DataHolderStatus.Failure)
            {
                return(BadRequest(createResult.Message));
            }

            return(Ok(_mapper.Map <CreditCardOrder, CreditCardOrderDto>(createResult.Data)));
        }