public List <CurrentAuction> GetIntialAuction(int CurrentUserPID) { // int CurrentUserPID = ((TradeBulk_Web.Authe_AuthoATION.CustomPrincipal)HttpContext.User).UserId; List <CurrentAuction> lscAuction = new List <CurrentAuction>(); GenericRepository <UserAuctionInfo> UserAuctionInfoRepository; GenericRepository <UserDetail> UserDetailRepository; using (UnitOfWork unitOfWork = new UnitOfWork()) { UserAuctionInfoRepository = unitOfWork.GetRepoInstance <UserAuctionInfo>(); UserDetailRepository = unitOfWork.GetRepoInstance <UserDetail>(); UserDetail cUser = UserDetailRepository.GetAllExpressions(x => x.UserPID == CurrentUserPID).FirstOrDefault <UserDetail>(); IEnumerable <UserAuctionInfo> currentUserAuction = UserAuctionInfoRepository.GetAllExpressions(x => x.ManagerUserDetailPID == cUser.ManagerPID, null, null, null); //CurrentUserPID = 11; //currentUserAuction = UserAuctionInfoRepository.GetAllExpressions(x => x.UserDetail.UserPID == CurrentUserPID, null, null, null); foreach (UserAuctionInfo usrAuction in currentUserAuction) { lscAuction.Add(new CurrentAuction() { UserName = usrAuction.UserDetail.FirstName, UserAmount = usrAuction.AuctionAmount.ToString(), Timestamp = usrAuction.Timestamp.ToString() }); } } //var something=from x in lscAuction select max LastUpdated = Convert.ToDateTime(lscAuction.Max(x => x.Timestamp)); return(lscAuction); }
public bool isAnyUpdate(int CurrentUserPID) { GenericRepository <UserAuctionInfo> UserAuctionInfoRepository; GenericRepository <UserDetail> UserDetailRepository; using (UnitOfWork unitOfWork = new UnitOfWork()) { UserAuctionInfoRepository = unitOfWork.GetRepoInstance <UserAuctionInfo>(); UserDetailRepository = unitOfWork.GetRepoInstance <UserDetail>(); UserDetail cUser = UserDetailRepository.GetAllExpressions(x => x.UserPID == CurrentUserPID).FirstOrDefault <UserDetail>(); IEnumerable <UserAuctionInfo> currentUserAuction = UserAuctionInfoRepository.GetAllExpressions(x => x.ManagerUserDetailPID == cUser.ManagerPID && x.Timestamp > LastUpdated, null, null, null); if (currentUserAuction.Count <UserAuctionInfo>() > 0) { return(true); } } return(false); }