Ejemplo n.º 1
0
        public async Task <IActionResult> Approve(PartyApplicantApproveInputModel input)
        {
            var approveUserId = await this.partyApplicantsService.ApproveAsync(input.PartyId, input.ApplicantId);

            if (approveUserId == null)
            {
                return(this.NotFound());
            }

            var user = await this.userManager.FindByIdAsync(input.ApplicantId);

            var username = await this.userManager.GetUserNameAsync(user);

            var email = await this.userManager.GetEmailAsync(user);

            var callbackUrl = this.Url.Action(
                "Applications",
                "Parties",
                values: new { id = username },
                protocol: this.Request.Scheme);

            var currentUsername = this.User.Identity.Name;

            await this.emailSender.SendEmailAsync(
                GlobalConstants.EmailSenderFrom,
                GlobalConstants.SystemName,
                email,
                "Party application approved",
                $"You application to {currentUsername}'s party has been approved. You can view your applications by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");

            this.TempData["InfoMessage"] = "Successfully approved user to party. A notification email has been send to him/her.";
            return(this.RedirectToAction("Host", "Parties", new { id = this.User.Identity.Name }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CancelApplication(PartyApplicantApproveInputModel input)
        {
            var partyId = await this.partyApplicantsService.CancelApplicationAsync(input.PartyId, input.ApplicantId);

            if (partyId == null)
            {
                return(this.NotFound());
            }

            this.TempData["InfoMessage"] = "Successfully canceled party application";
            return(this.RedirectToAction("Applications", "Parties", new { id = this.User.Identity.Name }));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Decline(PartyApplicantApproveInputModel input)
        {
            var declineUserId = await this.partyApplicantsService.DeclineAsync(input.PartyId, input.ApplicantId);

            if (declineUserId == null)
            {
                return(this.NotFound());
            }

            this.TempData["InfoMessage"] = "Successfully declined party applicant";
            return(this.RedirectToAction("Host", "Parties", new { id = this.User.Identity.Name }));
        }