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); }
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)); }