예제 #1
0
 public void UpdateEvent(Event theEvent, Location location)
 {
     using (var db = new EventRegEntities())
     {
         using (var tx = db.Database.BeginTransaction())
         {
             db.Entry(location).State = System.Data.Entity.EntityState.Modified;
             db.Entry(theEvent).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             tx.Commit();
         }
     }
 }
예제 #2
0
 public ActionResult Edit([Bind(Include = "event_ID,title,startDate,endDate,status,category,type,logoPath,description,location_ID")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.location_ID = new SelectList(db.Locations, "location_ID", "city", @event.location_ID);
     return(View(@event));
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "user_ID,username,password,lastName,firstName,phoneHome,phoneCell,phoneOffice,foodPref,companyName,branch,additionalInfo,location_ID")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.location_ID = new SelectList(db.Locations, "location_ID", "city", user.location_ID);
     return(View(user));
 }