Ejemplo n.º 1
0
        public async Task Test_JobCreateAndDelete()
        {
            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)
            };

            await businessLogic.CreateJob(newjob);

            var exists = businessLogic.JobExists(newjob.IdJob);

            //Assert.AreEqual(true, exists);

            await businessLogic.DeleteJob(newjob);

            exists = businessLogic.JobExists(newjob.IdJob);

            Assert.AreEqual(false, exists);
        }
Ejemplo n.º 2
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));
        }