public ActionResult Create(Role role)
        {
            if (ModelState.IsValid)//testing(role))//
            {
                _roleService.AddRole(role);
                return Json(new { success = true });
            }

            ViewBag.UserProfileID = new SelectList(_roleService.GetAllRole(), "RoleID", "RoleID", role.RoleID);
            return PartialView(BindRoleModel(role));
        }
예제 #2
0
 public static void AddRole(Role role)
 {
     CTSContext entities = new CTSContext();
     entities.Roles.Add(role);
     entities.SaveChanges();
 }
 public bool testing(Role role)
 {
     return TryValidateModel(role);
 }
 private RoleModel BindRoleModel(Role role)
 {
     RoleModel roleModel = new RoleModel
                               {
                                   Description = role.Description,
                                   Name = role.Name,
                                   RoleID = role.RoleID,
                                   SortOrder = role.SortOrder
                               };
     return roleModel;
 }
        public ActionResult Edit(Role role)
        {
            if (ModelState.IsValid)
            {
                _roleService.EditRole(role);

                return Json(new { success = true });
            }
            ViewBag.UserProfileID = new SelectList(_roleService.GetAllRole(), "RoleID", "RoleID", role.RoleID);
            return PartialView("Edit", role);
        }