예제 #1
0
 public void Update(Event @event)
 {
     _ctx.Entry(@event).State = EntityState.Modified;
 }
예제 #2
0
 public ActionResult Edit(Event @event)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _eventRepository.Update(@event);
             _eventRepository.SaveChanges();
         }
         catch (Exception ex)
         {
             ViewBag.Error = true;
             return View(@event);
         }
     }
     ViewBag.LocationId = new SelectList(_locationRepository.GetLocations().OrderBy(l => l.Name), "Id", "Name");
     ViewBag.TypeId = new SelectList(_eventTypeRepository.GetEventTypes().OrderBy(et => et.Name), "Id", "Name");
     ViewBag.Error = false;
     return View(@event);
 }
예제 #3
0
 public void Add(Event @event)
 {
     _ctx.Events.Add(@event);
 }