internal ServiceResult updateAuctionBid(string email, decimal bid) { ABUser user = _abUserRepository.FindBy(x => x.Email.ToString() == email).FirstOrDefault(); if (user != null && user.Role.UserRoleName.ToString() == "BIDDER") { Auction auctionResult = _auctionRepository.FindBy(x => x.AuctionGUID == user.ABUser_AuctionGUID).FirstOrDefault(); if (auctionResult.Auction_BidGUID == null) { if (bid > auctionResult.StartingBid && bid < user.Money) { Bid b = createNewBid(user, auctionResult, bid); _bidRepository.Add(b); auctionResult.Auction_BidGUID = b.BidGUID; _unitOfWork.Commit(); return(new ServiceResult() { Success = true }); } } else { if (bid > auctionResult.CurrentBid.BidPlaced && bid < user.Money) { Bid pBid = _bidRepository.FindBy(x => x.Bid_AuctionGUID == auctionResult.AuctionGUID).FirstOrDefault(); ABUser pBidder = _abUserRepository.FindBy(x => x.ABUserGUID == pBid.Bid_ABUserGUID).FirstOrDefault(); Bid b = createNewBid(user, auctionResult, bid); _bidRepository.Add(b); auctionResult.Auction_BidGUID = b.BidGUID; _unitOfWork.Commit(); SendEmail(pBidder); return(new ServiceResult() { Success = true }); } } } return(new ServiceResult() { ErrorMessage = "New bid could not be submitted.", Success = false }); }