private static async Task AddProjectToCategoryAsync(Project project, string categoryName, ICategoriesService categoriesService, IRepository <CategoryProject> categoryProjectsRepository) { var categoryId = categoriesService.GetCategoryIdByName(categoryName); var categoryProject = new CategoryProject { CategoryId = categoryId, ProjectId = project.Id, }; await categoryProjectsRepository.AddAsync(categoryProject); }
public async Task CreateAsync(int projectId, ICollection <int> categoriesId) { foreach (var categoryId in categoriesId) { var projectCategory = new CategoryProject { ProjectId = projectId, CategoryId = categoryId, }; await this.categoryProjectsRepository.AddAsync(projectCategory); await this.categoryProjectsRepository.SaveChangesAsync(); } }
public void RemoveCategoryProject(CategoryProject categoryProjects) { categoryProjects.IsDeleted = true; //context.Remove(AnnouncementUser); }
public void AddCategoryProject(CategoryProject categoryProject) { context.CategoryProjects.Add(categoryProject); }