コード例 #1
0
        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());
        }
コード例 #2
0
        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()));
        }
コード例 #3
0
        public async Task <int> CreateBid([FromBody] BidCreateRequest request)
        {
            var result = await _listingService.CreateBidAsync(request);

            return(result);
        }