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

            await _projectRepository.Delete(project.Adapt <ProjectEntity>());
        }
        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);
     }
 }
        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());
 }