Пример #1
0
 public ActionResult SaveMusicalRole(AdminEditMusicalRole m)
 {
     MusicalRole myMusicalRole = new MusicalRole();
     try
     {
         if (ModelState.IsValid)
         {
             myMusicalRole.roleID = m.RoleID;
             myMusicalRole.name = m.RoleName;
             myMusicalRole.musicalID = m.MusicalID;
             myMusicalRole.gender = m.Gender;
             myMusicalRole.grade = m.Grade;
             myMusicalRole.Save();
         }
         else
         {
             return View("EditMusicalRole", m);
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
         return View("EditMusicalRole", m);
     }
     return RedirectToRoute("AdminRoles", new { musicalID = m.MusicalID });
 }
Пример #2
0
        public ActionResult EditMusicalRole(int musicalID, int roleID)
        {
            MusicalRole mr = new MusicalRole(roleID);
            AdminEditMusicalRole m = new AdminEditMusicalRole();
            m.MusicalID = musicalID;
            m.RoleID = roleID;
            if (mr.roleID != 0)
            {
                m.RoleName = mr.name;
                m.Gender = mr.gender;
                m.Grade = mr.grade;
            };

            return View(m);
        }