public async Task <ExpenditureResponseModel> CreateExpenditure(ExpenditureRequestModel expenditureRequestModel) { var expenditure = new Expenditure { UserId = expenditureRequestModel.UserId, Amount = expenditureRequestModel.Amount, Description = expenditureRequestModel.Description, ExpDate = expenditureRequestModel.ExpDate, Remarks = expenditureRequestModel.Remarks }; var createdExpenditure = await _expenditureRepository.AddAsync(expenditure); var createdExpenditureResponseModel = new ExpenditureResponseModel { Id = createdExpenditure.Id, UserId = createdExpenditure.UserId, Amount = createdExpenditure.Amount, Description = createdExpenditure.Description, ExpDate = createdExpenditure.ExpDate, Remarks = createdExpenditure.Remarks }; return(createdExpenditureResponseModel); }
public async Task <Expenditures> AddExpenditure(ExpenditureRequestModel expenditureRequestModel) { var expenditure = new Expenditures { UsersId = expenditureRequestModel.UserId, Amount = expenditureRequestModel.Amount.Value, Description = expenditureRequestModel.Description }; return(await _expenditureRepository.AddAsync(expenditure)); }
public async Task AddExpenditure(ExpenditureRequestModel expenditureRequest) { var expenditure = new Expenditure { UserId = expenditureRequest.UserId, Amount = expenditureRequest.Amount, Description = expenditureRequest.Description, ExpDate = expenditureRequest.ExpDate, Remarks = expenditureRequest.Remarks }; await _expenditureRepository.AddAsync(expenditure); }
public async Task <ExpenditureResponseModel> UpdateExpenditure(ExpenditureRequestModel expenditureRequest) { var expenditure = new Expenditure { UserId = expenditureRequest.UserId, Amount = expenditureRequest.Amount, Description = expenditureRequest.Description, ExpDate = expenditureRequest.ExpDate, Remarks = expenditureRequest.Remarks, }; var updateExpenditure = await _expenditureRepository.UpdateAsync(expenditure); var response = new ExpenditureResponseModel { UserId = expenditure.UserId, Amount = expenditure.Amount, Description = expenditure.Description, ExpDate = expenditure.ExpDate, Remarks = expenditure.Remarks, }; return(response); }
public async Task <ExpenditureResponseModel> AddExpenditure(ExpenditureRequestModel model) { var expenditure = new Expenditures { UserId = model.UserId, Amount = model.Amount, Description = model.Description, ExpDate = model.ExpDate, Remarks = model.Remarks }; var addExpenditure = await _expenditureRepository.AddAsync(expenditure); var expenditureResponseModel = new ExpenditureResponseModel { Id = addExpenditure.Id, UserId = addExpenditure.UserId, Amount = addExpenditure.Amount, Description = addExpenditure.Description, ExpDate = addExpenditure.ExpDate, Remarks = addExpenditure.Remarks }; return(expenditureResponseModel); }
public async Task <IActionResult> Add(ExpenditureRequestModel model) { var expenditure = await _expenditureService.AddExpenditure(model); return(Ok(expenditure)); }
public async Task <IActionResult> Purchase([FromBody] ExpenditureRequestModel expenditureRequestModel) { await _expendituresService.AddExpenditure(expenditureRequestModel); return(Ok()); }
public async Task <ActionResult> UpdateExpenditure([FromBody] ExpenditureRequestModel expenditureRequest) { await _expendituresService.UpdateExpenditure(expenditureRequest); return(Ok()); }