public async Task <IActionResult> Edit(MyRecipeDetailsViewModel model) { if (!this.ModelState.IsValid) { return(this.View(model.RecipeEditViewModel)); } await this.recipesService.EditAsync(model.RecipeEditViewModel); return(this.RedirectToAction("RecipeList", "Recipes")); }
public async Task <IActionResult> RecipeList() { var user = await this.userManager.GetUserAsync(this.User); var recipes = await this.recipesService.GetAllRecipesByUserId <RecipeDetailsViewModel>(user.Id); var categories = await this.categoriesService.GetAllCategoriesAsync <CategoryDetailsViewModel>(); var model = new MyRecipeDetailsViewModel { Recipes = recipes, RecipeEditViewModel = new RecipeEditViewModel { Categories = categories, }, }; return(this.View(model)); }