예제 #1
0
        public async Task <IActionResult> CreateBid(DetailViewModel vm)
        {
            var post = context.Posts.Where(i => i.Id == vm.CreateBid.PostId).FirstOrDefault();

            var user = await userManager.FindByNameAsync(User.Identity.Name);

            Bid b = new Bid
            {
                BidBody  = vm.CreateBid.BidBody,
                BidDate  = DateTime.Now,
                BidPrice = vm.CreateBid.BidPrice,
                Status   = BidStatus.Waiting
            };

            bidService.CreateBidToProject(post, b, user);

            return(RedirectToAction("Details", new { id = vm.CreateBid.PostId }));
        }