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); } }
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); } }