Ejemplo n.º 1
0
        public ActionResult MyInfo(string code)
        {
            Student stu = new Student(code, Musical.CurrentMusical().musicalID);
            StudentMyInfoModel m = new StudentMyInfoModel()
            {
                Code = code,
                Email = stu.email,
                FirstName = stu.firstName,
                LastName = stu.lastName,
                Gender = stu.gender,
                Grade = stu.grade
            };

            return View(m);
        }
Ejemplo n.º 2
0
        public ActionResult SubmitMyInfo(StudentMyInfoModel m)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Student s = new Student(m.Code, Musical.CurrentMusical().musicalID);

                    s.code = m.Code;
                    s.firstName = m.FirstName;
                    s.lastName = m.LastName;
                    s.email = m.Email;
                    s.gender = m.Gender;
                    s.grade = m.Grade;
                    s.musicalID = Musical.CurrentMusical().musicalID;

                    List<int> DesiredRoleList = new List<int>();
                    if (m.DesiredRoles != null)
                        DesiredRoleList = m.DesiredRoles.ToList();

                    s.Save(DesiredRoleList);

                    return RedirectToRoute("StudentTime", new { code = s.code });
                }
                else
                {
                    return View("MyInfo", m);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View("MyInfo", m);
            }
        }