Esempio n. 1
0
        public async Task Test_BL_DeleteJob()
        {
            //Arrange
            JobBusinessLogic businessLogic = new JobBusinessLogic(inMemory: true);
            JobEntity        newjob        = new JobEntity()
            {
                JobId     = 1,
                Title     = "Backend Senior Developer",
                CreatedAt = DateTime.Now,
                ExpiresAt = DateTime.Now.AddDays(30)
            };

            //Act
            await businessLogic.CreateJob(newjob);

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

            //Assert
            Assert.True(exists, "Job created");

            //Act
            await businessLogic.DeleteJob(newjob);

            exists = businessLogic.JobExists(newjob.JobId);

            //Assert
            Assert.False(exists, "Job deleted");
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var jobEntity = await jobslogic.GetJob(id);

            await jobslogic.DeleteJob(jobEntity);

            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 3
0
        public async Task <ActionResult <JobEntity> > DeleteJob(int id)
        {
            var jobEntity = await logic.GetJob(id);

            if (jobEntity == null)
            {
                return(NotFound());
            }

            await logic.DeleteJob(jobEntity);

            return(jobEntity);
        }
Esempio n. 4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            JobEntity = await logic.GetJob((int)id);

            if (JobEntity != null)
            {
                await logic.DeleteJob(JobEntity);
            }

            return(RedirectToPage("./Index"));
        }