public async Task <IActionResult> Edit(EditFoodViewModel model) { if (ModelState.IsValid) { if (await _foodServices.EditFood(model)) { return(RedirectToAction(actionName: "Profile", controllerName: "Food", new { foodId = model.FoodId })); } } return(View(model)); }
public ActionResult EditFood(Receptmodels model) { if (string.IsNullOrWhiteSpace(model.Url_pic)) { model.Url_pic = "http://www.ica.se/imagevaultfiles/id_53491/cf_6901/ica_recept.png"; } if (string.IsNullOrWhiteSpace(model.Url_recept)) { model.Url_recept = "#"; } int page = (int)TempData["page"]; _foodservice.EditFood(model.Id, model.Name, model.Description, model.Url_pic, model.Url_recept); return(RedirectToAction("ALL", "Food", new { page = page })); }