public ActionResult Edit(ConferenceEditModel form) { var conf = _mediator.Send(form); return(this.RedirectToActionJson(c => c.Show(new ShowQuery { EventName = conf.Name }), "Default")); }
public ActionResult Save(ConferenceEditModel form) { var conf = _repository.GetById(form.Id); conf.ChangeName(form.Name); foreach (var attendeeEditModel in form.Attendees) { var attendee = conf.GetAttendee(attendeeEditModel.Id); attendee.ChangeName(attendeeEditModel.FirstName, attendeeEditModel.LastName); attendee.Email = attendeeEditModel.Email; } return(RedirectToRoute("Default", new { controller = "Conference", action = "Index" })); }
public ActionResult Edit(ConferenceEditModel form) { if (!ModelState.IsValid) { return(View(form)); } var conf = repository.GetById(form.Id); conf.ChangeName(form.Name); foreach (var attendeeEditModel in form.Attendees) { var attendee = conf.GetAttendee(attendeeEditModel.Id); attendee.ChangeName(attendeeEditModel.FirstName, attendeeEditModel.LastName); } repository.Update(conf); return(RedirectToAction("Index")); }
public override void FuncPreInitEditView(object id, ref Conference EditItem, ref ConferenceEditModel model) { if (EditItem == null) { //get the item by id EditItem = new ConferenceModel <Conference>().Get(id); } if (EditItem != null) { model = new ConferenceEditModel(); model.EditItem = EditItem; var subjects = new SubjectModel <Subject>().GetData(isBlock: false); ViewBag.SubjectID = subjects.Select(x => new CustomSelectListItem() { Text = x.SubjectName, Value = x.SubjectID.ToString() }).ToList(); } }
public ActionResult Edit(string eventName) { var conf = _repository.GetByName(eventName); var model = new ConferenceEditModel { Id = conf.Id, Name = conf.Name, Attendees = conf.GetAttendees() .Select(a => new ConferenceEditModel.AttendeeEditModel { Id = a.Id, FirstName = a.FirstName, LastName = a.LastName, Email = a.Email, }).ToArray() }; return(View(model)); }
public ActionResult Edit(ConferenceEditModel form) { if (!ModelState.IsValid) { return(View(form)); } var conf = _repository.GetById(form.Id); conf.ChangeName(form.Name); foreach (var attendeeEditModel in form.Attendees) { var attendee = conf.GetAttendee(attendeeEditModel.Id); attendee.ChangeName(attendeeEditModel.FirstName, attendeeEditModel.LastName); attendee.Email = attendeeEditModel.Email; } return(this.RedirectToAction(c => c.Index(null), "Default")); }
public ActionResult Edit(string eventName) { var conf = repository.GetByName(eventName); if (conf != null) { var model = new ConferenceEditModel { Id = conf.Id, Name = conf.Name, Attendees = conf.GetAttendees() .Select(a => new ConferenceEditModel.AttendeeEditModel { Id = a.Id, FirstName = a.FirstName, LastName = a.LastName, EMail = a.EMail }).ToList() }; return(View(model)); } return(View("Index")); }
public ActionResult Edit(ConferenceEditModel form) { var success = this.RedirectToAction(c => c.Index(null), "Default"); return(Form(form, success)); }
public ActionResult Save(ConferenceEditModel form) { _mediator.Send(form); return(RedirectToRoute("Default", new { controller = "Conference", action = "Index" })); }