示例#1
0
 public bool DeleteRole(Role entity)
 {
     if (entity == null) return false;
     _unitOfWork.RoleRepository.Delete(entity);
     _unitOfWork.Save();
     return true;
 }
示例#2
0
        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));
        }
示例#3
0
 private RoleModel BindRoleModel(Role role)
 {
     RoleModel roleModel = new RoleModel
                               {
                                   Description = role.Description,
                                   Name = role.Name,
                                   RoleID = role.RoleID,
                                   SortOrder = role.SortOrder
                               };
     return roleModel;
 }
示例#4
0
 public bool testing(Role role)
 {
     return TryValidateModel(role);
 }
示例#5
0
        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);
        }
示例#6
0
文件: Role.cs 项目: FishAbe/cats
 public static void AddRole(Role role)
 {
     //CTSContext entities = new CTSContext();
     //entities.Roles.Add(role);
     //entities.SaveChanges();
 }
示例#7
0
 public bool EditRole(Role entity)
 {
     _unitOfWork.RoleRepository.Edit(entity);
     _unitOfWork.Save();
     return true;
 }
示例#8
0
 public bool AddRole(Role entity)
 {
     _unitOfWork.RoleRepository.Add(entity);
     _unitOfWork.Save();
     return true;
 }