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();
            }
        }
Beispiel #3
0
 public void RemoveCategoryProject(CategoryProject categoryProjects)
 {
     categoryProjects.IsDeleted = true;
     //context.Remove(AnnouncementUser);
 }
Beispiel #4
0
 public void AddCategoryProject(CategoryProject categoryProject)
 {
     context.CategoryProjects.Add(categoryProject);
 }