public async Task <IActionResult> CreateDeposit([FromBody] DepositCreationDto deposits)
        {
            if (deposits == null)
            {
                return(BadRequest());
            }

            var depositEntity = _mapper.Map <Deposit>(deposits);

            depositEntity.Date = DateTime.Now;

            if (!ModelState.IsValid)
            {
                return(new ModelValidator.UnprocessableEntityObjectResult(ModelState));
            }

            await _depositserv.AddDeposit(depositEntity);

            var x = _depositserv.ConvertCurrency(depositEntity);
            await _accountService.AddDepositToBalance(deposits.UserId, x.Result);

            var DepositMapToReturn = _mapper.Map <DepositViewDto>(depositEntity);

            return(Ok(DepositMapToReturn));
        }
Exemple #2
0
        public async Task BuyDeposit()
        {
            var isSuccess = _depositService.AddDeposit();

            var updatedVM = new DepositsVM()
            {
                Deposits = _mapper.Map <List <DepositVM> >(_depositService.Deposits)
            };

            await Clients.All.SendAsync("BuyDepositCallback", isSuccess, updatedVM);
        }
        public IActionResult AddDepositNewUser(DepositOwnerVm model)
        {
            //if (ModelState.IsValid)
            //{
            var SelectedSeason = model.Deposit.SeasonTireId;

            ViewBag.SelectedSeason = model.Deposit.SeasonTireId;
            var id = _depositService.AddDeposit(model);

            return(RedirectToAction("ViewDepositById", "Deposit", new { id = id }));
            //}
            //else
            //{
            //    return View(model);
            //}
        }