private void AskQuestion() { var category = _categoryProvider.GetCategory(CurrentPlayer.Location); Console.WriteLine("The category is " + category); Console.WriteLine(_questionProvider.GetQuestion(category)); }
public async Task <CategoryUpdateResult> UpdateCategory(CategoryUpdate model) { await validator.ValidateUpdateModel(model); var toUpdate = await context.Categories.SingleOrDefaultAsync(x => x.Id == model.Id); if (toUpdate == null) { throw new ArgumentException($"Can't fine category with id {model.Id}"); } toUpdate = mapper.MapCategory(toUpdate, model); await context.SaveChangesAsync(); var categoryModel = await categoryProvider.GetCategory(model.Id); return(new CategoryUpdateResult() { Category = categoryModel }); }
public async Task <Category> GetCategory(int categoryId) { return(await _categoryProvider.GetCategory(categoryId)); }