Example #1
0
 public void Create(DalRole entity)
 {
     var role = new Role()
     {
         Id = entity.Id,
         RoleOfUser = entity.RoleOfUser
     };
     context.Set<Role>().Add(role);
 }
Example #2
0
        public FrmRoleEditor(Entities.Role role = null)
        {
            InitializeComponent();

            CreateControls();

            this.role = new Role();

            if (role != null)
            {
                this.role.Copy(role);
                this.editRole = role;
            }

            SetupControls();
            BindControls();
        }
 public override void CreateRole(string roleName)
 {
     if (!string.IsNullOrEmpty(roleName))
     {
         using (DataContext Context = new DataContext())
         {
             Role Role = null;
             Role = Context.Roles.FirstOrDefault(Rl => Rl.RoleName == roleName);
             if (Role == null)
             {
                 Role NewRole = new Role
                                    {
                                        RoleId = Guid.NewGuid(),
                                        RoleName = roleName
                                    };
                 Context.Roles.Add(NewRole);
                 Context.SaveChanges();
             }
         }
     }
 }
 public int Update_Roles(Role r)
 {
     RolesBAL rolesBal = new RolesBAL();
     return rolesBal.Update_RolesBAL(r);
 }
Example #5
0
 public static void CheckIfNotNull(Role value, string role)
 {
     CheckIfNotNull(value, role, "Cannot find '{0}' role");
 }
Example #6
0
 public bool Delete(Entities.Role role)
 {
     return(true);
 }
Example #7
0
 public bool Update(Entities.Role role)
 {
     return(true);
 }
Example #8
0
 public bool Insert(Entities.Role role)
 {
     return(true);
 }
Example #9
0
 public bool RemoveTaskFromRole(Entities.Role role, Entities.Task task)
 {
     return(true);
 }
Example #10
0
 public bool AddTaskToRole(Entities.Role role, Entities.Task task)
 {
     return(true);
 }
        public override void CreateRole(string roleName)
        {
            if (string.IsNullOrEmpty(roleName))
                throw ErrorUtility.CreateArgumentNullOrEmptyException("roleName");

            if (RoleExists(roleName))
                throw new InvalidOperationException(
                    string.Format(CultureInfo.InvariantCulture, "Role '{0}' already exists", roleName));

            var role = new Role { RoleName = roleName };
            _roles.Create(role);
            _uow.Commit();
        }