Пример #1
0
        protected internal bool Insert(string roleName)
        {
            try
            {
                AuthenticationLibrary.Model.Role obj = new AuthenticationLibrary.Model.Role();
                obj.RoleName = roleName;

                OE.Roles.Add(obj);
                OE.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #2
0
 public bool Insert(AuthenticationLibrary.Model.User user, AuthenticationLibrary.Model.Role role)
 {
     try
     {
         if (user != null && role != null)
         {
             DLL.UserRole userRole = new DLL.UserRole();
             return(userRole.Insert(user, role));
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #3
0
        protected internal bool Insert(AuthenticationLibrary.Model.User user, AuthenticationLibrary.Model.Role role)
        {
            try
            {
                AuthenticationLibrary.Model.UserRole obj = new AuthenticationLibrary.Model.UserRole();
                obj.Role = new AuthenticationLibrary.Model.Role {
                    RoleId = role.RoleId, RoleName = role.RoleName
                };
                obj.User = new AuthenticationLibrary.Model.User {
                    UserId = user.UserId, Password = user.Password, UserName = user.UserName
                };

                OE.UserRoles.Add(obj);
                OE.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }