public async Task <IActionResult> Edit(int id, [Bind("Id,R_id,Weight,S_id")] MyRecipe_Seasoning myRecipe_Seasoning) { if (id != myRecipe_Seasoning.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(myRecipe_Seasoning); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MyRecipe_SeasoningExists(myRecipe_Seasoning.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["R_id"] = new SelectList(_context.MyRecipe, "Id", "Id", myRecipe_Seasoning.R_id); ViewData["S_id"] = new SelectList(_context.Seasoning, "Id", "Id", myRecipe_Seasoning.S_id); return(View(myRecipe_Seasoning)); }
public async Task <IActionResult> Create([Bind("Id,R_id,Weight,S_id")] MyRecipe_Seasoning myRecipe_Seasoning) { if (ModelState.IsValid) { _context.Add(myRecipe_Seasoning); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["R_id"] = new SelectList(_context.MyRecipe, "Id", "Id", myRecipe_Seasoning.R_id); ViewData["S_id"] = new SelectList(_context.Seasoning, "Id", "Id", myRecipe_Seasoning.S_id); return(View(myRecipe_Seasoning)); }