public override void CreateRole(string roleName) { var newRole = new Role() { Name = roleName }; using (var context = new UserContext()) { context.Roles.Add(newRole); context.SaveChanges(); } }
/// <summary> /// Deprecated Method for adding a new object to the Roles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRoles(Role role) { base.AddObject("Roles", role); }
/// <summary> /// Create a new Role object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="privilege">Initial value of the Privilege property.</param> public static Role CreateRole(global::System.Int32 id, global::System.String privilege) { Role role = new Role(); role.Id = id; role.Privilege = privilege; return role; }
/// <summary> /// Create a new Role object. /// </summary> /// <param name="roleID">Initial value of the RoleID property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> /// <param name="portalID">Initial value of the PortalID property.</param> /// <param name="roleName">Initial value of the RoleName property.</param> public static Role CreateRole(global::System.Int32 roleID, global::System.DateTime createDate, global::System.Int32 portalID, global::System.String roleName) { Role role = new Role(); role.RoleID = roleID; role.CreateDate = createDate; role.PortalID = portalID; role.RoleName = roleName; return role; }
/// <summary> /// Create a new Role object. /// </summary> /// <param name="applicationId">Initial value of the ApplicationId property.</param> /// <param name="roleId">Initial value of the RoleId property.</param> /// <param name="roleName">Initial value of the RoleName property.</param> /// <param name="role_ID">Initial value of the Role_ID property.</param> public static Role CreateRole(global::System.Guid applicationId, global::System.Guid roleId, global::System.String roleName, global::System.Int32 role_ID) { Role role = new Role(); role.ApplicationId = applicationId; role.RoleId = roleId; role.RoleName = roleName; role.Role_ID = role_ID; return role; }