예제 #1
0
        public async Task VerifyDeleteProjectFunction()
        {
            var project = TestData.GetProjects().LastOrDefault();

            await _manageProject.DeleteProject(project);

            _projectRepository.Verify(r => r.DeleteProject(project), Times.Once);
        }
        public async Task <IActionResult> Delete(int id)
        {
            if (!ModelState.IsValid || id <= 0)
            {
                return(BadRequest("Project id is not valid."));
            }

            var project = await _manageProject.GetProject(id);

            if (project == null)
            {
                return(BadRequest("Project details not found with given id:" + id));
            }
            await _manageProject.DeleteProject(project);

            return(Ok(project.ProjectId));
        }