Exemple #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var user = await _context.GetMentorAsync(this.Username);

            var mentor = user.Mentor;

            if (mentor == null)
            {
                return(NotFound($"Unable to load user with ID '{Username}'."));
            }


            if (mentor.Address != null)
            {
                return(Redirect("/Error"));
            }

            await _context.UpdateMentor(mentor, AddressMentor);

            return(Redirect("./Certificates"));
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Redirect("/Error"));
            }

            var user = await _context.GetMentorAsync(this.Username);

            if (user.Mentor == null)
            {
                return(NotFound($"Unable to load user with ID '{Username}'."));
            }

            if (user.Mentor.StrategicDomains == null)
            {
                user.Mentor.StrategicDomains = new List <StrategicDomain>();
            }

            await _context.UpdateMentor(user.Mentor, this.StrategicDomain);

            this.SuccessfullyCreated = true;

            return(RedirectToPage());
        }
Exemple #3
0
        /// <summary>
        /// Adds strategic domains to the User's mentor profile
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnPostAsync()
        {
            //checks to see if model state is valid
            if (!ModelState.IsValid)
            {
                return(Redirect("/Error"));
            }

            //gets the users mentor profile based on the username
            var user = await _context.GetMentorAsync(this.Username);

            //checks to see if the mentor is null
            if (user.Mentor == null)
            {
                return(NotFound($"Unable to load user with ID '{Username}'."));
            }

            //checks to see mentors strategic domains is null if so creates a new list
            if (user.Mentor.StrategicDomains == null)
            {
                user.Mentor.StrategicDomains = new List <StrategicDomain>();
            }

            //Adds the strategic domains to the mentor profile
            await _context.UpdateMentor(user.Mentor, this.StrategicDomain);

            this.SuccessfullyCreated = true;

            return(RedirectToPage());
        }
Exemple #4
0
        /// <summary>
        /// Adds the certificate to the User's mentor profile
        /// </summary>
        /// <returns>
        ///
        /// </returns>
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Redirect("/Error"));
            }

            var user = await _context.GetMentorAsync(this.Username);

            if (user.Mentor == null)
            {
                return(NotFound($"Unable to load user with ID '{Username}'."));
            }

            await _context.UpdateMentor(user.Mentor, Certificate);

            this.SuccessCreated = "Successfully Created a Certificate";

            return(RedirectToPage());
        }
        /// <summary>
        /// Adds the certificate to the User's mentor profile
        /// </summary>
        /// <returns>
        ///
        /// </returns>
        public async Task <IActionResult> OnPostAsync()
        {
            //Checks to see if model state is valid
            if (!ModelState.IsValid)
            {
                return(Redirect("/Error"));
            }

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

            //checks to see if user mentor section is null
            if (user.Mentor == null)
            {
                return(NotFound($"Unable to load user with ID '{Username}'."));
            }

            //Adds the certificate to the mentor profile
            await _context.UpdateMentor(user.Mentor, Certificate);

            this.SuccessCreated = "Successfully Created a Certificate";

            return(RedirectToPage());
        }