public async Task <List <NewsCategoryDto> > GetAllNewsCategory() { using (IDAL.INewsCategoryService Svc = new DAL.NewsCategoryService()) { return(await Svc.GetAllAsync().Select(m => new Dto.NewsCategoryDto() { CategoryId = m.CategoryId, CategoryName = m.CategoryName }).ToListAsync()); } }
public async Task AddNewsCategory(string CategoryId, string newsCategoryName) { using (IDAL.INewsCategoryService Svc = new DAL.NewsCategoryService()) { await Svc.CreateAsync(new NewsCategory() { ModifyTime = DateTime.Now, CategoryId = CategoryId, CategoryName = newsCategoryName }); } }