public void Update(Event @event) { _ctx.Entry(@event).State = EntityState.Modified; }
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); }
public void Add(Event @event) { _ctx.Events.Add(@event); }