public ActionResult Order(int id) { var recipe = db.Get(id); var priceComputing = new PriceComputing(); var model = new OrderViewModel { Product = recipe, Price = priceComputing.ComputeRecipePrice(recipe) }; return(View(model)); }
public IActionResult Details(int Id) { //return Content(Id.ToString()); var model = _recipeData.Get(Id); if (model == null) { return(RedirectToAction(nameof(Index))); } return(View(model)); }
public async Task <IActionResult> GetRecipe(int id) { try { RecipeResult = await recipeData.Get(id); if (!ModelState.IsValid) { return(BadRequest()); } return(Ok(mapper.Map <RecipeDto>(RecipeResult))); } catch (Exception ex) { return(StatusCode(500, new { message = ex.Message })); } }