public async Task <GenericResponse> CreateDebt(DebtsAppModel createDebtsRequest)
        {
            var debt = createDebtsRequest.ToEntity();

            await _debtsServices.CreateDebtAsync(debt, DebtType.Simple);

            await _unitOfWork.CommitAsync();

            return(new GenericResponse {
                Id = debt.Id
            });
        }
        public async Task <GenericResponse> AddValuesCard(DebtsAppModel debtsAppModel, string CardName)
        {
            var debt     = debtsAppModel.ToEntity();
            var debtCard = await _cardService.LinkCard(debt, CardName);

            await _debtsService.CreateDebtAsync(debtCard, DebtType.Card);

            await _unitOfWork.CommitAsync();

            return(new GenericResponse {
                Id = debt.Id
            });
        }
Beispiel #3
0
        public async Task <ActionResult <GenericResponse> > AddValuesCardAsync([FromBody] DebtsAppModel debtsAppModel, string CardName)
        {
            var cardId = await _cardsApplicationService.AddValuesCard(debtsAppModel, CardName);

            return(new OkObjectResult(cardId));
        }
Beispiel #4
0
        public async Task <ActionResult <GenericResponse> > CreateSimpleAsync([FromBody] DebtsAppModel createDebtsRequest)
        {
            var debt = await _debtsApplicationService.CreateDebt(createDebtsRequest);

            return(new OkObjectResult(debt));
        }
Beispiel #5
0
 public static Debt ToEntity(this DebtsAppModel model)
 {
     return(Mapper.Map <Debt>(model));
 }