Beispiel #1
0
        public IActionResult AcceptBid(int bidId, int postId)
        {
            var currentUser = _bidService.GetBidsByPostId(postId).FirstOrDefault(x => x.Id == bidId).AppUser;

            _bidService.AcceptBid(bidId, postId, currentUser);
            return(Redirect("/Client/Home/Index"));
        }
        public IActionResult AcceptBid(int bidID)
        {
            Guid         userID = userService.GetUserID(HttpContext.User.Identity.Name);
            DatabaseCode result = bidService.AcceptBid(bidID, userID);

            if (result == DatabaseCode.Updated)
            {
                SetMessage(new MessageViewModel()
                {
                    Message = "Bid has been accepted and the contractor has been notified."
                });
            }
            else if (result == DatabaseCode.NotAllowed)
            {
                SetMessage(new MessageViewModel()
                {
                    Message = "You cannot accept a bid for a product you didn't make. This has been logged."
                });
            }
            else
            {
                SetMessage(new MessageViewModel()
                {
                    Message = "Sorry but an error has occured."
                });
            }
            return(RedirectToAction("Dashboard", "Account"));
        }