Example #1
0
        public async Task <IActionResult> Create(long id)
        {
            var contract = this.contractService.GetById(id);
            MoneyInCreateInputModel moneyInCreateInputModel = new MoneyInCreateInputModel()
            {
                ContractId      = id,
                OperationAmount = contract.PremiumAmount
            };

            return(this.View(moneyInCreateInputModel));
        }
Example #2
0
        public async Task <IActionResult> Create(MoneyInCreateInputModel moneyInCreateInputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View());
            }
            MoneyInServiceModel moneyInServiceModel = AutoMapper.Mapper.Map <MoneyInServiceModel>(moneyInCreateInputModel);

            moneyInServiceModel.ContractId = moneyInCreateInputModel.Id;
            moneyInServiceModel.Id         = 0;
            await this.moneyInService.Create(moneyInServiceModel);

            await this.contractService.TryToApplyFinancial(moneyInServiceModel.ContractId);

            this.TempData["info"] = String.Format(MONEYIN_CREATED);
            return(this.Redirect($"/Contract/Details/{moneyInServiceModel.ContractId}"));
        }