Ejemplo n.º 1
0
        public async Task <ActionResult> Create(ParticipanteViewModel collection)
        {
            try
            {
                // TODO: Add insert logic here

                var result = _participanteRepository.Adicionar(Participante(collection));
                if (result.Email != null)
                {
                    IdentityUser identityUser = await _userManager.FindByEmailAsync(result.Email);

                    if (identityUser != null)
                    {
                        IdentityResult identityResult = await _userManager.AddToRoleAsync(identityUser, "Participante");

                        if (identityResult.Succeeded)
                        {
                            await _signInManager.SignOutAsync();

                            HttpContext.Session.Remove("_UserEmail");
                            return(RedirectToAction("Eventos", "Evento"));
                        }
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(collection));
            }
        }
        public async Task Adicionar(Participante Participante)
        {
            if (!ExecutarValidacao(new ParticipanteValidation(), Participante))
            {
                return;
            }



            await _ParticipanteRepository.Adicionar(Participante);
        }
Ejemplo n.º 3
0
 public Participante Adicionar(Participante entity)
 {
     return(_participanteRository.Adicionar(entity));
 }