public ActionResult RegisterA(RegisterAViewModel vm) { Registration registration = vm.Registration; registration.Courses.Add(this.context.Courses.FirstOrDefault(c => c.Id == vm.Course1)); registration.Courses.Add(this.context.Courses.FirstOrDefault(c => c.Id == vm.Course2)); registration.Courses.Add(this.context.Courses.FirstOrDefault(c => c.Id == vm.Course3)); registration.RegistrationDateTime = DateTime.Now; this.context.Registrations.Add(registration); this.context.SaveChanges(); MailService.ConfirmRegistrationDirect(registration.Id); MailService.ConfirmRegistrationInformBackoffice(registration.Id); return this.RedirectToAction("RegistrationSuccessful", vm); }
public ActionResult RegisterA() { var vm = new RegisterAViewModel(); return this.View(vm); }