コード例 #1
0
        public async Task <IActionResult> Review([FromRoute] Guid id, bool approved)
        {
            var ong = await _ongAppService.Find(id);

            ong.Approved = approved ? "Sim" : "Não";
            await _ongAppService.Update(ong);

            if (approved)
            {
                var user = await _userAppService.CreateONGUser(ong.ResponsibleEmail);

                await _ongAppService.UpdateUserId(ong, Guid.Parse(user.User.Id));

                await _emailSender.SendEmailAsync(ong.ResponsibleEmail, ong.Name,
                                                  $@"<p>Nova senha: {user.TempPassword} <br />
                       Será alterada no primeiro logi.</p>");
            }

            TempData[TempDataConstants.ShowAlert] = approved ? AlertFactory.NewONGApproved() : AlertFactory.NewONGReproved();

            return(RedirectToAction("Index", new { area = "Admin" }));
        }