public async Task AddTransactionAsync(OfferTransaction transaction) { if (transaction == null) { throw new ArgumentNullException(nameof(transaction)); } DL.OfferTransactions dbTr = _mapper.Map <DL.OfferTransactions>(transaction); dbTr.CreateDate = DateTime.UtcNow; _dbContext.OfferTransactions.Add(dbTr); await _dbContext.SaveChangesAsync(); }
public async Task <IActionResult> AddOfferItems(AddOfferItemsViewModel addVm) { if (ModelState.IsValid) { string userId = _userManager.GetUserId(User); OfferTransaction tr = new OfferTransaction() { CreateUserId = userId, OfferId = addVm.OfferId, Amount = addVm.Amount, Type = OfferTransactionType.Supply }; await _offerProvider.AddTransactionAsync(tr); return(RedirectToAction(nameof(PlaceOffers), new { id = addVm.PlaceId, area = "" })); } else { return(View(addVm)); } }