示例#1
0
        public ActionResult ApproveBid(int id, JobBid jobBid)
        {
            var userId      = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var foundUser   = _repo.SiteManager.FindByCondition(a => a.IdentityUserId == userId).SingleOrDefault();
            var foundJobBid = _repo.JobBid.FindByCondition(a => a.JobBidId == id).SingleOrDefault();
            var foundJob    = _repo.Job.FindByCondition(a => a.JobId == foundJobBid.JobId).SingleOrDefault();

            foundJob.Status = "Approved";
            _repo.Job.Update(foundJob);
            foundJobBid.IsWinningBid = true;
            _repo.JobBid.Update(foundJobBid);
            _repo.Save();
            return(RedirectToAction("Index", "SiteManagers"));
        }
示例#2
0
        public ActionResult Bid(JobBid jobBid)
        {
            var userId    = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var foundUser = _repo.Trucker.FindByCondition(a => a.IdentityUserId == userId).SingleOrDefault();
            var job       = _repo.Job.ReturnJob(jobBid);

            try
            {
                job.Status = "Pending";
                _repo.Job.Update(job);
                jobBid.TruckerId = foundUser.TruckerId;
                _repo.JobBid.Create(jobBid);
                _repo.Save();
                return(RedirectToAction("Index", "Truckers"));
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
 public Job ReturnJob(JobBid jobBid) => FindByCondition(a => a.JobId == jobBid.JobId).SingleOrDefault();