Beispiel #1
0
        public ActionResult Edit(EventEdit model)
        {
            if (!ModelState.IsValid) {
                var contract = Service.GetReleaseEventForEdit(model.Id);
                model.CopyNonEditableProperties(contract);
                return View(model);
            }

            Service.UpdateEvent(model.ToContract());

            return RedirectToAction("EventsBySeries");
        }
Beispiel #2
0
        public ActionResult Edit(EventEdit model)
        {
            // Either series or name must be specified. If series is specified, name is generated automatically.
            if (!model.SeriesId.HasValue && string.IsNullOrEmpty(model.Name)) {
                ModelState.AddModelError("Name", "Name cannot be empty");
            }

            if (!ModelState.IsValid) {

                if (model.Id != 0) {
                    var contract = Service.GetReleaseEventForEdit(model.Id);
                    model.CopyNonEditableProperties(contract);
                }

                return View(model);
            }

            var id = queries.Update(model.ToContract()).Id;

            return RedirectToAction("Details", new { id });
        }