Esempio n. 1
0
        public async Task <IActionResult> OnPostEmailAsync()
        {
            UserBrief ub = new UserBrief();


            ub.UserID = UserID;
            ub.Email  = Request.Form["EmailAddress"];
            HttpResponseMessage message = await DS.PutAsync(ub, "User/UpdateUserEmail");

            switch (message.StatusCode)
            {
            case System.Net.HttpStatusCode.OK:
                SaveStatus = "Email Saved";
                break;

            case System.Net.HttpStatusCode.Forbidden:
                SaveStatus = "Forbidden";
                break;

            case System.Net.HttpStatusCode.Unauthorized:
                SaveStatus = "Unauthorized";
                break;

            case System.Net.HttpStatusCode.InternalServerError:
                SaveStatus = "Error";
                break;
            }
            await GetUserInfo();

            return(Page());
        }
Esempio n. 2
0
 private RoomPlayer UserBriefToRoomPlayer(UserBrief brief)
 {
     return(new RoomPlayer {
         ID = brief.Uid,
         Name = brief.Name,
     });
 }
Esempio n. 3
0
        public static bool Validate(this UserBrief brief)
        {
            if (brief.BriefId < 1)
            {
                throw new AppException("The provided user brief lacks a brief", ExceptionType.Validation);
            }

            if (brief.UserId < 1)
            {
                throw new AppException("The provided user brief lacks a user", ExceptionType.Validation);
            }

            return(true);
        }
        private static void TestDynamicMethods(UserService userService)
        {
            Func <User, object> selector = product => (object)new { product.Id, product.Email };
            Expression <Func <User, object> > selectorExp = product => (object)new { product.Id, product.Email };
            Func <object, UserBrief>          maker       = product =>
            {
                UserBrief brief = new UserBrief();
                brief.Id    = product.GetPropertyValue <int>(o => brief.Id);
                brief.Email = product.GetPropertyValue <string>(o => brief.Email);
                return(brief);
            };

            TestWithFuncParam(userService, selector, maker);
            TestWithExpressionParam(userService, selectorExp, maker);
        }
Esempio n. 5
0
        public async Task <IActionResult> OnPostUserAsync()
        {
            SocialMediaGrid           = new SocialMediaJSON();
            SocialMediaGrid.discord   = Request.Form["Discord"];
            SocialMediaGrid.isntagram = Request.Form["Insta"];
            SocialMediaGrid.onlyfans  = Request.Form["OF"];
            SocialMediaGrid.patreon   = Request.Form["Patreon"];
            SocialMediaGrid.twitch    = Request.Form["Twitch"];
            SocialMediaGrid.twitter   = Request.Form["Twitter"];
            SocialMediaGrid.tumblr    = Request.Form["Tumblr"];
            UserBrief UB = new UserBrief();

            UB.UserID           = int.Parse(Request.Form["FormUserID"]);
            UB.SocialMediaArray = JsonConvert.SerializeObject(SocialMediaGrid);
            UB.ImageURL         = Request.Form["ImageURL"];
            UB.Description      = Request.Form["Description"];

            string response = await DS.PutAsyncString(UB, "User/UpdateUserProfile");

            await GetUserInfo();

            return(Page());
        }
Esempio n. 6
0
        public async Task <IActionResult> OnPostUserImageAsync()
        {
            UserBrief           ub      = new UserBrief(UserID, "", Request.Form["txtImgURL"]);
            HttpResponseMessage message = await DS.PutAsync(ub, "User/UpdateUserImage");

            switch (message.StatusCode)
            {
            case System.Net.HttpStatusCode.OK:
                SaveStatus = "Image Saved";
                break;

            case System.Net.HttpStatusCode.Forbidden:
                SaveStatus = "Image Forbidden";
                break;

            case System.Net.HttpStatusCode.Unauthorized:
                SaveStatus = "Image Unauthorized";
                break;

            case System.Net.HttpStatusCode.InternalServerError:
                SaveStatus = "Image Error";
                break;
            }


            //Refresh TCM
            string result = await DS.GetAsync("User/GetUserByID/" + UserID);

            UBWB = Newtonsoft.Json.JsonConvert.DeserializeObject <UserBriefWithBadges>(result);

            if (UBWB.User.UserID == myAuthService.getUserID())
            {
                isProfileUser = true;
            }

            return(Page());
        }
        public async Task <IActionResult> OnPostUserAsync()
        {
            UserBriefWithBadges UBWB = new UserBriefWithBadges();
            UserBrief           u    = new UserBrief();
            UserSettings        us   = new UserSettings();

            u.UserID           = int.Parse(Request.Form["UserID"]);
            u.Description      = Request.Form["UserDescription"];
            u.Email            = Request.Form["UserEmail"];
            u.UserName         = Request.Form["UserName"];
            u.ImageURL         = Request.Form["UserImageURL"];
            u.Rank             = int.Parse(Request.Form["UserRank"]);
            u.SocialMediaArray = Request.Form["UserSocialMediaArray"];
            u.Title            = Request.Form["UserTitle"];

            string en = Request.Form["UserEmailFailed"];

            if (en == "on" || en == "true")
            {
                us.EmailFailed = true;
            }
            else
            {
                us.EmailFailed = false;
            }

            UBWB.User     = u;
            UBWB.Settings = us;

            Response = await DS.PutAsyncSR(UBWB, "User/UpdateUser");


            await GetUsers();

            return(Page());
        }