Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdJob,JobTitle,Description,CreatedAt,ExpiredAt")] Job job)
        {
            if (id != job.IdJob)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await businessLogicJob.UpdateJob(job);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!businessLogicJob.JobExists(job.IdJob))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(job));
        }
Exemplo n.º 2
0
        public async Task Test_JobCreateAndUpdate()
        {
            BL_Job businessLogic = new BL_Job(null, true);


            Job newjob = new Job()
            {
                JobTitle    = ".NET Developer",
                Description = ".NET Developer Description",
                CreatedAt   = DateTime.Now,
                ExpiredAt   = DateTime.Now.AddDays(30)
            };

            string jobTittle = ".NET Developer";
            await businessLogic.CreateJob(newjob);

            newjob.JobTitle = ".NET Developer 2";

            await businessLogic.UpdateJob(newjob);

            Assert.AreEqual(true, (jobTittle != newjob.JobTitle));
        }