public ActionResult Create(Channel channel) { db.Database.Connection.ConnectionString = Suma2Lealtad.Modules.AppModule.ConnectionString("SumaLealtad"); if (ModelState.IsValid) { if (db.Channels.Count() > 0) { channel.id = db.Channels.Max(c => c.id) + 1; } else { channel.id = 1; } db.Channels.Add(channel); db.SaveChanges(); return RedirectToAction("Index"); } return View(channel); }
public ActionResult Edit(Channel channel) { db.Database.Connection.ConnectionString = Suma2Lealtad.Modules.AppModule.ConnectionString("SumaLealtad"); if (ModelState.IsValid) { db.Entry(channel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(channel); }