public async Task CreateCategory(string name, Guid userId) { using (IDAL.IBlogCategory categorySvc = new DAL.BlogCategoryService()) { await categorySvc.CreateAsync(new Models.BlogCategory() { CategoryName = name, UserId = userId }); } }
public async Task <List <BlogCategoryDto> > GetAllCategories(Guid userId) { using (IDAL.IBlogCategory categorySvc = new DAL.BlogCategoryService()) { return(await categorySvc.GetAllAsync().Where(m => m.UserId == userId).Select(m => new BlogCategoryDto() { Id = m.Id, CategoryName = m.CategoryName }).ToListAsync()); } }