public async Task <IActionResult> Edit(int id, [Bind("Id,Producto,Aseguradora,Activo,ComisionPrimaBase")] ProductoAseguradora productoAseguradora) { if (id != productoAseguradora.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productoAseguradora); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductoAseguradoraExists(productoAseguradora.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Aseguradora"] = new SelectList(_context.Aseguradora, "Id", "Nombre", productoAseguradora.Aseguradora); ViewData["Producto"] = new SelectList(_context.Producto, "Id", "Producto1", productoAseguradora.Producto); return(View(productoAseguradora)); }
public async Task <IActionResult> Create([Bind("Id,Producto,Aseguradora,Activo,ComisionPrimaBase")] ProductoAseguradora productoAseguradora) { if (ModelState.IsValid) { _context.Add(productoAseguradora); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Aseguradora"] = new SelectList(_context.Aseguradora, "Id", "Nombre", productoAseguradora.Aseguradora); ViewData["Producto"] = new SelectList(_context.Producto, "Id", "Producto1", productoAseguradora.Producto); return(View(productoAseguradora)); }