public async Task <ActionResult> Register(User user) { try { User getUser = service.Get(u => user.Email == u.Email); if (getUser.Email != null) { return(RedirectToAction("Error", "Home")); } else { if (service.GetAll().Count == 0) { user.IsAdmin = true; } service.Create(user); emailService = new EmailSendingService(); await emailService.SendConfirmationEmailAsync(user); return(RedirectToAction("Login")); } } catch (Exception ex) { logger.LogCustomException(ex, null); return(RedirectToAction("Error", "Home")); } }