public async Task <IActionResult> Edit(int id, [Bind("CustoFlorId,FlorId,Quantidade,ValorCalculado,DataCadastro")] CustoFlor custoFlor) { if (id != custoFlor.CustoFlorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(custoFlor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustoFlorExists(custoFlor.CustoFlorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FlorId"] = new SelectList(_context.Set <Flor>(), "FlorId", "Descricao", custoFlor.FlorId); return(View(custoFlor)); }
public async Task <IActionResult> Create([Bind("CustoFlorId,FlorId,Quantidade,ValorCalculado,DataCadastro")] CustoFlor custoFlor) { if (ModelState.IsValid) { _context.Add(custoFlor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FlorId"] = new SelectList(_context.Set <Flor>(), "FlorId", "Descricao", custoFlor.FlorId); return(View(custoFlor)); }