示例#1
0
        /// <summary>
        /// Inputs the updated address and about information to the Protege profile
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnPostAsync()
        {
            //checks to see if model state is valid
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            //Gets the protege profile based on the username
            var user = await _context.GetProtegeAsync(this.Username);

            //checks to see if the user is null
            if (user == null)
            {
                return(Redirect("/Error"));
            }

            //Sets protege to the protege profile
            var Protege = user.Protege;

            //Adds the Inputed address data to the protege address data
            Protege.Address.City           = Address.City;
            Protege.Address.State          = Address.State;
            Protege.Address.StreetAddress  = Address.StreetAddress;
            Protege.Address.StreetAddress2 = Address.StreetAddress2;
            Protege.Address.ZipCode        = Address.ZipCode;

            await _context.SaveChangesAsync();

            //Adds the About section the protege profile
            await _context.AddProtegeAboutAsync(Protege, About);

            return(RedirectToPage("./Detail"));
        }