Ejemplo n.º 1
0
        public async Task <IActionResult> OnPost(IFormFile avatar)
        {
            var          imageByte = avatar;
            BinaryReader br        = new BinaryReader(imageByte.OpenReadStream());

            userProfile.AvatarOne = br.ReadBytes((int)imageByte.OpenReadStream().Length);
            userProfile.Username  = token.username;
            userProfile.Firstname = Request.Form["firstname"];
            userProfile.Lastname  = Request.Form["lastname"];
            userProfile.Email     = Request.Form["email"];
            userProfile.Cell      = Request.Form["cell"];

            userProfile.AddressOne = Request.Form["addressone"];
            userProfile.AddressTwo = Request.Form["addresstwo"];
            userProfile.Zip        = Request.Form["zip"];

            userProfile.NameOnCard = Request.Form["nameoncard"];
            userProfile.CVV        = Request.Form["cvv"];
            userProfile.CardNumber = Request.Form["cardnumber"];

            userProfile.ExpirationOnCard = DateTime.Parse(Request.Form["expdate"]);
            userProfile.PaymentType      = Request.Form["paymenttype"];

            var helper = new UserProfileHelper(Configuration, token);

            if (await helper.PostProfile(userProfile))
            {
                return(RedirectToPage("/Profile"));
            }
            else
            {
                return(RedirectToPage("/Error"));
            }
        }
        public async Task <IActionResult> OnPost(IFormFile avatar)
        {
            var          imageByte = avatar;
            BinaryReader br        = new BinaryReader(imageByte.OpenReadStream());

            userProfile.AvatarOne = br.ReadBytes((int)imageByte.OpenReadStream().Length);
            userProfile.Username  = token.username;
            userProfile.Firstname = Request.Form["firstname"];
            userProfile.Lastname  = Request.Form["lastname"];
            userProfile.Email     = Request.Form["email"];
            userProfile.Cell      = Request.Form["cell"];

            userProfile.AddressOne = Request.Form["addressone"];
            userProfile.AddressTwo = Request.Form["addresstwo"];
            userProfile.Zip        = Request.Form["zip"];

            var helper = new UserProfileHelper(Configuration, token);

            if (await helper.PostProfile(userProfile))
            {
                return(RedirectToPage("/Profile"));
            }
            else
            {
                return(RedirectToPage("/Error"));
            }
        }