public List <CategoryDto> GetAllCategoriesSync() { using (IDAL.ICategoryService categorySvc = new DAL.CategoryService()) { return(categorySvc.GetAll(m => true).Select(m => new CategoryDto() { UserId = m.UserId, CategoryName = m.CategoryName, CategoryId = m.Id }).ToList()); } }
public async Task <List <CategoryDto> > GetAllCategories(int top) { using (IDAL.ICategoryService categorySvc = new DAL.CategoryService()) { return(await categorySvc.GetAll(m => true).Take(top).Select(m => new CategoryDto() { UserId = m.UserId, CategoryName = m.CategoryName, CategoryId = m.Id }).ToListAsync()); } }
public async Task <CategoryDto> GetCategoryById(Guid id) { using (IDAL.ICategoryService categoryService = new DAL.CategoryService()) { var category = await categoryService.GetOneByIdAsync(id); return(new CategoryDto() { CategoryId = category.Id, CategoryName = category.CategoryName, UserId = category.UserId }); } }