Exemple #1
0
        /// <summary>
        /// add user to database
        /// </summary>
        /// <param name="UserUserName">username</param>
        /// <param name="UserPassword">password</param>
        /// <param name="UserName">name</param>
        /// <returns>Success status</returns>
        public User AddUser(User user)
        {
            DataSet ReturnedData = SqlConnector.Select("user_username", "[BarberShop].[dbo].[Users]", $"where user_username = '******'");

            if (!DataToObj.IsRecordExist(ReturnedData))
            {
                SqlConnector.Insert("Users", $"'{user.UserUserName.Trim()}','{user.UserPassword.Trim()}','{user.UserName.Trim()}'");
                return(DataToObj.DataToUser(SqlConnector.Select("*", "[BarberShop].[dbo].[Users]", $"where user_username = '******'")));
            }
            return(null);
        }
Exemple #2
0
        public User GetUserByUserId(int UserId)
        {
            DataSet ReturnedData = SqlConnector.Select("*", "Users", $"where user_user_id = {UserId} ");

            return(DataToObj.DataToUser(ReturnedData));
        }
Exemple #3
0
        public User GetUserByUserName(string Username)
        {
            DataSet ReturnedData = SqlConnector.Select("*", "Users", $"where user_username = '******' ");

            return(DataToObj.DataToUser(ReturnedData));
        }