コード例 #1
0
        public async Task Delete(Project project)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            await _projectRepository.Delete(project.Adapt <ProjectEntity>());
        }
コード例 #2
0
        public IActionResult Delete(int id, string nameFilter, int pageNo)
        {
            var project = projectsRepo.Get(id);

            if (project == null)
            {
                return(IndexWithError(NOT_FOUND_ERROR, nameFilter, pageNo));
            }
            projectsRepo.Delete(id);
            return(IndexRedirect(nameFilter, pageNo));
        }
コード例 #3
0
 public bool Deletar(int ID)
 {
     try
     {
         return(_projectsRepository.Delete(ID));
     }
     catch
     {
         return(false);
     }
 }
コード例 #4
0
        public async Task <ActionResult> Delete(int id)
        {
            var del = await _projectRepository.GetCountryByIdAsync(id);


            _projectRepository.Delete(del);

            if (await _projectRepository.SaveAllAsync())
            {
                return(NoContent());
            }

            throw new Exception("Error deleting the message");
        }
コード例 #5
0
        public async Task <Unit> Handle(DeleteProjectCommand request, CancellationToken cancellationToken)
        {
            var project = await _repository.Get(request.Id);

            if (project is null)
            {
                throw new EntityNotFound(nameof(project));
            }

            _repository.Delete(project);
            await _repository.SaveChanges();

            return(Unit.Value);
        }
コード例 #6
0
        public async Task <Response <ProjectDTO> > Delete(Guid projectId, Guid userId)
        {
            var projectUser = await _projectsUsersRepository.GetFullProjectUser(projectId, userId);

            if (projectUser == null || projectUser.Status != MembershipStatus.SuperAdmin)
            {
                return(new ForbiddenErrorResponse <ProjectDTO>(new []
                {
                    new Error
                    {
                        Code = ErrorCodes.Security.Forbidden,
                        Message = ErrorMessages.Security.Forbidden
                    }
                }));
            }

            var companyUser = await _companiesUsersRepository.GetCompanyUser(projectUser.Project.Team.CompanyId, userId);

            if (companyUser == null || companyUser.Status != MembershipStatus.SuperAdmin)
            {
                return(new ForbiddenErrorResponse <ProjectDTO>(new []
                {
                    new Error
                    {
                        Code = ErrorCodes.Security.Forbidden,
                        Message = ErrorMessages.Security.Forbidden
                    }
                }));
            }

            var entity = await _repository.Delete(projectId);

            return(new Response <ProjectDTO>
            {
                Data = _mapper.Map <ProjectModel, ProjectDTO>(entity)
            });
        }
コード例 #7
0
 public void Delete(int id)
 {
     _projectsRepository.Delete(id);
 }
コード例 #8
0
 public void Delete(ProjectsEntity entity)
 {
     service.Delete(entity);
 }
コード例 #9
0
 public CommonResult Delete(int id)
 {
     _projectRepository.Delete(id);
     return(CommonResult.Success());
 }