示例#1
0
        public string UpdateProfile(User model)
        {
            var userid = _httpContextAccessor.HttpContext.User.GetLoggedInUserId <string>();

            if (string.IsNullOrEmpty(userid))
            {
                throw new InvalidOperationException("User Not found");
            }

            CoreSQLConnection CoreSQL   = new CoreSQLConnection();
            ArrayList         arrayList = new ArrayList();

            try
            {
                var sqlQuery = "Update tblLogin_User set LUserPass = '******' where LUserId = '" + userid + "'";

                arrayList.Add(sqlQuery);
                CoreSQL.CoreSQL_SaveDataUseSQLCommand(arrayList);
                return("Successfully Updated.");
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
            }
        }
        public string CreateUser(User model)
        {
            CoreSQLConnection CoreSQL   = new CoreSQLConnection();
            ArrayList         arrayList = new ArrayList();
            var Query    = "SELECT  cast(Isnull(MAX(UserId),0) + 1 AS float)  AS UserId FROM tbl_loginUsers";
            var variable = CoreSQL.CoreSQL_GetDoubleData(Query);

            try
            {
                var sqlQuery = "Insert Into tbl_loginUsers (UserId, UserName, UserPass, UserMail, DisplayName)" +
                               " Values ('" + variable + "','" + model.UserName.ToLower() + "','" + CoreSQL.GetEncryptedData(model.UserPassword) + "', '" + model.UserMail + "','" + model.DisplayName + "')";
                arrayList.Add(sqlQuery);
                CoreSQL.CoreSQL_SaveDataUseSQLCommand(arrayList);
                return("Successfully Save.");
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
            }
        }