/// <summary>
        /// Adds a New UserType
        /// Level: Logic
        /// </summary>
        /// <param name="UserType">The UserType</param>
        /// <returns>True if Successful, False if Not</returns>
        public bool AddUserType(string UserType)
        {
            try
            {
                UserTypesRepository myRepository = new UserTypesRepository();

                if (!myRepository.UserTypeExists(UserType))
                {
                    Common.UserType myUserType = new UserType();

                    myUserType.Type = UserType;

                    myRepository.AddUserType(myUserType);

                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
Example #2
0
        //-----------------------------------------------------------------------------------------------------------------//
        public void AddUserType(string username,UserType userType)
        {
            User user = GetUser(username);
            user.UserType.Add(userType);
            entities.User.Attach(user);

            entities.User.ApplyCurrentValues(user);
            entities.SaveChanges();
        }
 //Adds UserType
 public void AddUserType(UserType UserType)
 {
     try
     {
         Entities.AddToUserTypes(UserType);
         Entities.SaveChanges();
     }
     catch (Exception Exception)
     {
         throw Exception;
     }
 }
Example #4
0
 public void Create(User user,UserType ut)
 {
     user.UserType.Add(ut);
     entities.AddToUser(user);
     entities.SaveChanges();
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the UserType EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserType(UserType userType)
 {
     base.AddObject("UserType", userType);
 }
 /// <summary>
 /// Create a new UserType object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static UserType CreateUserType(global::System.Guid id, global::System.String name)
 {
     UserType userType = new UserType();
     userType.ID = id;
     userType.Name = name;
     return userType;
 }
 /// <summary>
 /// Create a new UserType object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 public static UserType CreateUserType(global::System.Int32 id, global::System.String type)
 {
     UserType userType = new UserType();
     userType.Id = id;
     userType.Type = type;
     return userType;
 }