public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,FechaModificacion")] Cliente cliente) { var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); var logger = LogManager.GetLogger(typeof(ClientesController)); if (id != cliente.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cliente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(cliente.Id)) { return(NotFound()); } else { throw; } } logger.Info("Se Modifico El Cliente: " + id); return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Descripcion,FechaModificacion,ClienteId")] Plan plan) { var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); var logger = LogManager.GetLogger(typeof(ClientesController)); if (id != plan.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(plan); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanExists(plan.Id)) { return(NotFound()); } else { throw; } } logger.Info("Se Modifico El Plan: " + id); return(RedirectToAction(nameof(Index))); } ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Id", plan.ClienteId); return(View(plan)); }