public ActionResult Edit(ConferenceEditModel form)
        {
            var conf = _mediator.Send(form);

            return(this.RedirectToActionJson(c => c.Show(new ShowQuery {
                EventName = conf.Name
            }), "Default"));
        }
Ejemplo n.º 2
0
        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" }));
        }
Ejemplo n.º 3
0
        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"));
        }
Ejemplo n.º 4
0
 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();
     }
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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"));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 9
0
        public ActionResult Save(ConferenceEditModel form)
        {
            _mediator.Send(form);

            return(RedirectToRoute("Default", new { controller = "Conference", action = "Index" }));
        }