Exemplo n.º 1
0
        public async Task <IncomeResponseModel> CreateIncome(IncomeRequestModel incomeRequestModel)
        {
            var income = new Income
            {
                UserId      = incomeRequestModel.UserId,
                Amount      = incomeRequestModel.Amount,
                Description = incomeRequestModel.Description,
                IncomeDate  = incomeRequestModel.IncomeDate,
                Remarks     = incomeRequestModel.Remarks
            };

            var createdIncome = await _incomeRepository.AddAsync(income);

            var createdIncomeResponseModel = new IncomeResponseModel
            {
                Id          = createdIncome.Id,
                UserId      = createdIncome.UserId,
                Amount      = createdIncome.Amount,
                Description = createdIncome.Description,
                IncomeDate  = createdIncome.IncomeDate,
                Remarks     = createdIncome.Remarks
            };

            return(createdIncomeResponseModel);
        }
        public async Task <Incomes> AddIncome(IncomeRequestModel incomeRequestModel)
        {
            var income = new Incomes
            {
                UsersId     = incomeRequestModel.UserId,
                Amount      = incomeRequestModel.Amount.Value,
                Description = incomeRequestModel.Description
            };

            return(await _incomeRepository.AddAsync(income));
        }
 public async Task AddIncome(IncomeRequestModel incomeRequest)
 {
     var income = new Income
     {
         UserId      = incomeRequest.UserId,
         Amount      = incomeRequest.Amount,
         Description = incomeRequest.Description,
         IncomeDate  = incomeRequest.IncomeDate,
         Remarks     = incomeRequest.Remarks,
     };
     await _incomeRepository.AddAsync(income);
 }
        public async Task <IncomeResponseModel> UpdateIncome(IncomeRequestModel incomeRequest)
        {
            var income = new Income
            {
                UserId      = incomeRequest.UserId,
                Amount      = incomeRequest.Amount,
                Description = incomeRequest.Description,
                IncomeDate  = incomeRequest.IncomeDate,
                Remarks     = incomeRequest.Remarks,
            };
            var updateIncome = await _incomeRepository.UpdateAsync(income);

            var response = new IncomeResponseModel
            {
                UserId      = income.UserId,
                Amount      = income.Amount,
                Description = income.Description,
                IncomeDate  = income.IncomeDate,
                Remarks     = income.Remarks,
            };

            return(response);
        }
        public async Task <IncomeResponseModel> AddIncome(IncomeRequestModel model)
        {
            var income = new Incomes
            {
                UserId      = model.UserId,
                Amount      = model.Amount,
                Description = model.Description,
                IncomeDate  = model.IncomeDate,
                Remarks     = model.Remarks
            };
            var addIncome = await _incomeRepository.AddAsync(income);

            var incomeResponseModel = new IncomeResponseModel
            {
                Id          = addIncome.Id,
                UserId      = addIncome.UserId,
                Amount      = addIncome.Amount,
                Description = addIncome.Description,
                IncomeDate  = addIncome.IncomeDate,
                Remarks     = addIncome.Remarks
            };

            return(incomeResponseModel);
        }
Exemplo n.º 6
0
        public async Task <IActionResult> CreateIncome(IncomeRequestModel model)
        {
            var income = await _incomeService.CreateIncome(model);

            return(Ok(income));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Purchase([FromBody] IncomeRequestModel incomeRequestModel)
        {
            await _incomeService.AddIncome(incomeRequestModel);

            return(Ok());
        }
Exemplo n.º 8
0
        public async Task <ActionResult> UpdateIncome([FromBody] IncomeRequestModel incomeRequest)
        {
            await _incomeService.UpdateIncome(incomeRequest);

            return(Ok());
        }