예제 #1
0
        /// <summary>
        /// Action for Veteran.
        /// </summary>
        /// <param name="userid"></param>
        public void AddtoQueue(string userid)
        {
            if (!IsInQueue() && !IsMatched())
            {
                VeteranQueue vq = new VeteranQueue();
                vq.TimeEnteredQueue         = DateTime.UtcNow;
                vq.VeteranApplicationUserId = userid;

                _context.VeteranQueue.Add(vq);
                _context.SaveChanges();
            }
        }
예제 #2
0
        public void FindVeteran()
        {
            if (_context.VeteranQueue.Any())
            {
                string       userid = _userManager.GetUserId(_httpContext.User);
                VeteranQueue vq     = _context.VeteranQueue.First();

                VeteranLawyerMatch newMatch = new VeteranLawyerMatch();
                newMatch.IsDateTimeApproved       = false;
                newMatch.IsLocationApproved       = false;
                newMatch.LawyerApplicationUserId  = userid;
                newMatch.VeteranApplicationUserId = vq.VeteranApplicationUserId;

                _context.VeteranLawyerMatches.Add(newMatch);
                _context.SaveChanges();
                _context.VeteranQueue.Remove(vq);
                _context.SaveChanges();
            }
        }