예제 #1
0
        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);
        }
예제 #2
0
 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);
 }