// GET: BackOffice/Events/Create public ActionResult Create() { var e = new Event(); e.Translations.Add(new EventTranslation { LanguageCode = LanguageDefinitions.DefaultLanguage }); return View(GenerateViewModel(e)); }
private EventEditViewModel GenerateViewModel(Event e) { var model = new EventEditViewModel(); model.Event = e; return model; }
public async Task<ActionResult> Edit(Event @event) { if (ModelState.IsValid) { db.Update(@event); foreach (var t in @event.Translations) { db.UpdateTranslation(t); } await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(GenerateViewModel(@event)); }