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)); }
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"); }
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); }
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) }); }
public void Delete(int id) { _projectsRepository.Delete(id); }
public void Delete(ProjectsEntity entity) { service.Delete(entity); }
public CommonResult Delete(int id) { _projectRepository.Delete(id); return(CommonResult.Success()); }