Use new method in controller
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
namespace Francesco.Recipes.World.Controller.Instruction
|
namespace Francesco.Recipes.World.Controller.Instruction
|
||||||
{
|
{
|
||||||
|
using Francesco.Recipes.World.Models;
|
||||||
using Francesco.Recipes.World.Repositories.Instruction;
|
using Francesco.Recipes.World.Repositories.Instruction;
|
||||||
using Francesco.Recipes.World.Services.Instruction;
|
using Francesco.Recipes.World.Services.Instruction;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -50,11 +51,14 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var instructions = await _instructionRepository.GetInstructionsOfRecipeAsync(recipeId);
|
var sortedInstructions = await _instructionService.GetSortedInstructionsAsync(recipeId);
|
||||||
var sortedInstructions = instructions.OrderBy(i => i.Number).ToList();
|
var viewModel = new InstructionViewModel
|
||||||
ViewData["RecipeId"] = recipeId;
|
{
|
||||||
|
RecipeId = recipeId,
|
||||||
|
Instructions = sortedInstructions,
|
||||||
|
};
|
||||||
|
|
||||||
return View("~/Views/Shared/_GetInstructions.cshtml", sortedInstructions);
|
return View("~/Views/Shared/_GetInstructions.cshtml", viewModel);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user