コード例 #1
0
        public void RemovePoemFromCategory(CategoryPoemDto categoryPoem)
        {
            var categorypoem = _categoryPoemRepository.FirstOrDefault(o => o.CategoryId == categoryPoem.CategoryId && o.PoemId == categoryPoem.PoemId);

            if (categorypoem != null)
            {
                _categoryPoemRepository.DeleteAsync(categorypoem, true);
            }
        }
コード例 #2
0
        public void AddPoemToCategory(CategoryPoemDto categoryPoem)
        {
            var categorypoem = _categoryPoemRepository.FirstOrDefault(o => o.CategoryId == categoryPoem.CategoryId && o.PoemId == categoryPoem.PoemId);

            if (categorypoem == null)
            {
                categorypoem = new CategoryPoem {
                    CategoryId = categoryPoem.CategoryId, PoemId = categoryPoem.PoemId
                };
                _categoryPoemRepository.InsertAsync(categorypoem, true);
            }
        }