public async Task <int> CreateBidAsync(BidCreateRequest request) { Bid bid = _mapper.Map <Bid>(request); bid.CreateDate = DateTime.Now; bid.ListingId = request.ListingId; await _repository.BidRepo.CreateAsync(bid); return(await _repository.SaveChangesAsync()); }
public async Task <IActionResult> Create(BidCreateRequest request) { if (!ModelState.IsValid) { return(RedirectToAction("Index", "Listing")); } var user = HttpContext.Session.GetComplexData <UserVm>("User"); request.UserId = user.Id; int status = await _listingsController.CreateBid(request); if (status != 0) { TempData["CreateBidStatus"] = "Success"; } return(Redirect("/ListingDetail/Index/" + request.ListingId.ToString())); }
public async Task <int> CreateBid([FromBody] BidCreateRequest request) { var result = await _listingService.CreateBidAsync(request); return(result); }