コード例 #1
0
        // GET: BackOffice/Events/Create
        public ActionResult Create()
        {
            var e = new Event();
            e.Translations.Add(new EventTranslation
                {
                    LanguageCode = LanguageDefinitions.DefaultLanguage
                });

            return View(GenerateViewModel(e));
        }
コード例 #2
0
        private EventEditViewModel GenerateViewModel(Event e)
        {
            var model = new EventEditViewModel();
            model.Event = e;

            return model;
        }
コード例 #3
0
        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));
        }