public void AddCandidate(Candidate c)
        {
            var repo = new CandidatesRepository(_connectionString);

            c.Status = Status.Pending;
            repo.AddCandidate(c);
        }
Пример #2
0
        public ActionResult AddCandidate(Candidate candidate)
        {
            var cRepo = new CandidatesRepository(Properties.Settings.Default.Constr);

            cRepo.AddCandidate(candidate);
            return(RedirectToAction("Index"));
        }
Пример #3
0
        public ActionResult AddCandidate(Candidate candidate)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            repo.AddCandidate(candidate);
            return(Redirect("/Home/Pending"));
        }
Пример #4
0
 public CandidatesController(CandidatesRepository candidate,
                             ApplicationDbContext context,
                             UserManager <ApplicationUser> userManager)
 {
     _candidate   = candidate;
     _ctx         = context;
     _userManager = userManager;
 }
Пример #5
0
        public ActionResult Details(int id)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);
            var vm   = new DetailsViewModel();

            vm.Candidate = repo.GetCandidate(id);
            return(View(vm));
        }
Пример #6
0
        public ActionResult Rejected()
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);
            var vm   = new CandidatesViewModel();

            vm.Candidates = repo.GetCandidates(CandidateStatus.Rejected);
            return(View(vm));
        }
Пример #7
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            filterContext.Controller.ViewBag.Pending  = repo.GetCount(CandidateStatus.Pending);
            filterContext.Controller.ViewBag.Accepted = repo.GetCount(CandidateStatus.Accepted);
            filterContext.Controller.ViewBag.Rejected = repo.GetCount(CandidateStatus.Rejected);
            base.OnActionExecuting(filterContext);
        }
Пример #8
0
        public ActionResult UpdateStatus(int id, CandidateStatus status)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            repo.ChangeStatus(id, status);
            return(Json(new { pending = repo.GetCount(CandidateStatus.Pending),
                              accepted = repo.GetCount(CandidateStatus.Accepted),
                              rejected = repo.GetCount(CandidateStatus.Rejected) }));
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var cRepo = new CandidatesRepository(Properties.Settings.Default.Constr);

            filterContext.Controller.ViewBag.PendingCount   = cRepo.GetCount(Status.Pending);
            filterContext.Controller.ViewBag.ConfirmedCount = cRepo.GetCount(Status.Confirmed);
            filterContext.Controller.ViewBag.RefusedCount   = cRepo.GetCount(Status.Refused);
            base.OnActionExecuting(filterContext);
        }
Пример #10
0
        public ActionResult GetCounts()
        {
            var cRepo  = new CandidatesRepository(Properties.Settings.Default.Constr);
            var counts = new Counts
            {
                Pending   = cRepo.GetCount(Status.Pending),
                Confirmed = cRepo.GetCount(Status.Confirmed),
                Refused   = cRepo.GetCount(Status.Refused)
            };

            return(Json(counts, JsonRequestBehavior.AllowGet));
        }
        public CountsViewModel GetStatuses()
        {
            var repo     = new CandidatesRepository(_connectionString);
            var statuses = repo.GetStatuses();
            var vm       = new CountsViewModel();

            foreach (Status status in statuses)
            {
                if (status == Status.pending)
                {
                    vm.PendingCount++;
                }
                else if (status == Status.refused)
                {
                    vm.RefusedCount++;
                }
                else if (status == Status.confirmed)
                {
                    vm.ConfirmedCount++;
                }
            }
            return(vm);
        }
        public CountsModel GetCounts()
        {
            var repo = new CandidatesRepository(_connectionString);

            return(repo.GetCounts());
        }
Пример #13
0
        public void UpdateStatus(int id, Status status)
        {
            var cRepo = new CandidatesRepository(Properties.Settings.Default.Constr);

            cRepo.UpdateStatus(id, status);
        }
        public void Refuse(int id)
        {
            var repo = new CandidatesRepository(_connectionString);

            repo.Refuse(id);
        }
        public Candidate GetCandidateForId(int id)
        {
            var repo = new CandidatesRepository(_connectionString);

            return(repo.GetById(id));
        }
        public void AddCandidate(Candidate candidate)
        {
            var repo = new CandidatesRepository(_connectionString);

            repo.AddCandidate(candidate);
        }
        public List <Candidate> GetPending()
        {
            var repo = new CandidatesRepository(_connectionString);

            return(repo.GetCandidateByStatus(Status.pending));
        }
Пример #18
0
        public ActionResult Refused()
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            return(View(repo.GetRefused()));
        }
Пример #19
0
        public ActionResult ViewDetails(int candidateId)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            return(View(repo.ViewDetails(candidateId)));
        }
Пример #20
0
        public void Refuse(int candidateId)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            repo.Refuse(candidateId);
        }
        public List <Candidate> GetConfirmed()
        {
            var repo = new CandidatesRepository(_connectionString);

            return(repo.GetCandidateByStatus(Status.confirmed));
        }
Пример #22
0
        public ActionResult UpdateStatus()
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            return(Json(new { Pending = repo.GetPendingCount(), Confirmed = repo.GetConfirmedCount(), Refused = repo.GetRefusedCount() }, JsonRequestBehavior.AllowGet));
        }
        public List <Candidate> GetRefusedCandidates()
        {
            var repo = new CandidatesRepository(_connectionString);

            return(repo.GetRefusedCandidates());
        }
Пример #24
0
        public ActionResult Refused()
        {
            var cRepo = new CandidatesRepository(Properties.Settings.Default.Constr);

            return(View(cRepo.GetCandidates(Status.Refused)));
        }
        public void Confirm(int id)
        {
            var repo = new CandidatesRepository(_connectionString);

            repo.Confirm(id);
        }
        public void ChangeStatus(Candidate c)
        {
            var repo = new CandidatesRepository(_connectionString);

            repo.ChangeStatus(c);
        }
        public int GetConfirmedCount()
        {
            var repo = new CandidatesRepository(_connectionString);

            return(repo.GetConfirmedCandidates().Count);
        }
Пример #28
0
        public ActionResult Details(int id)
        {
            var cRepo = new CandidatesRepository(Properties.Settings.Default.Constr);

            return(View(cRepo.GetCandidateById(id)));
        }