Exemplo n.º 1
0
        public ActionResult Applicants(int?id)
        {
            SelectAdvTestMasterViewModel advtestmaster = new SelectAdvTestMasterViewModel();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (jobAdvManager.Find(x => x.JobAdvId == id.Value).SelectedTestMaster != null)
            {
                WarningViewModel erv = new WarningViewModel()
                {
                    Title = "HATA",
                    RedirectingTimeout = 2000,
                    RedirectingUrl     = "/Job_Adv/Details/" + id
                };
                erv.Items.Add("Görevde atanmış bir Test Master bulunmaktadır..!");
                return(View("Warning", erv));
            }
            else
            {
                Job_Adv job_Adv = jobAdvManager.Find(x => x.JobAdvId == id.Value);
                if (job_Adv == null)
                {
                    return(HttpNotFound());
                }
                List <Test_Master> tms = new List <Test_Master>();
                foreach (var item in jobAppManager.List(x => x.Job_Adv.JobAdvId == id.Value))
                {
                    tms.Add(item.Test_Master);
                }
                advtestmaster.Adv_Id      = job_Adv.JobAdvId;
                advtestmaster.testMasters = tms;
                return(View(advtestmaster));
            }
        }
Exemplo n.º 2
0
        public ActionResult Applicants(SelectAdvTestMasterViewModel tm)
        {
            if (ModelState.IsValid)
            {
                TestMasterManager tmm = new TestMasterManager();
                if (tm == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                Job_Adv job_Adv = jobAdvManager.Find(x => x.JobAdvId == tm.Adv_Id);
                if (job_Adv == null)
                {
                    return(HttpNotFound());
                }
                job_Adv.SelectedTestMaster = tmm.GetTestMasterById(tm.selectedTestMasterId).Result;

                if (jobAdvManager.Update(job_Adv) > 0)
                {
                    foreach (var item in jobAppManager.List(x => x.Job_Adv.JobAdvId == job_Adv.JobAdvId))
                    {
                        jobAppManager.Delete(item);
                    }
                    Test_Master selectedTM = tmm.GetTestMasterById(tm.selectedTestMasterId).Result;
                    OkViewModel OkntfyObj  = new OkViewModel()
                    {
                        Title              = "Atama Başarılı..",
                        RedirectingUrl     = "/Job_Adv/Details/" + tm.Adv_Id,
                        RedirectingTimeout = 3000
                    };
                    OkntfyObj.Items.Add("Test Master " + selectedTM.user_name + " " + selectedTM.user_surname + " Başarılı bir şekilde " + job_Adv.job_adv_title + " görevine atandı..!");
                    return(View("Ok", OkntfyObj));
                }
            }
            return(View(tm));
        }