Exemplo n.º 1
0
 //INSERT
 public bool commitInsert(events ev)
 {
     using (objEvents)
     {
         objEvents.events.InsertOnSubmit(ev);
         objEvents.SubmitChanges();
         return true;
     }
 }
 public ActionResult EventDelete(int id, events Event)
 {
     try
     {
         objEvent.commitDelete(id);
         return RedirectToAction("EventsAdminIndex");
     }
     catch
     {
         return View("EventsAdminIndex");
     }
 }
        public ActionResult InsertEvent(events Events)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    objEvent.commitInsert(Events);
                    return RedirectToAction("EventsAdminIndex");
                }
                catch
                {
                    return View();
                }
            }

            return View();
        }
 public ActionResult UpdateEvent(int id, events Event)
 {
     if (ModelState.IsValid)
     {
         try
         {
             objEvent.commitUpdate(id, Event.ev_title, Event.ev_date, Event.ev_location, Event.ev_desc);
             return RedirectToAction("EventsAdminIndex");
         }
         catch
         {
             return View();
         }
     }
     return View();
 }
 partial void Deleteevents(events instance);
 partial void Updateevents(events instance);
 partial void Insertevents(events instance);