public ActionResult CreateUser(LoginResponse login) { string Token = ""; var weatherappuser1 = _weatherService.Get(login.Email); // Console.WriteLine("After Check"+login.Email); if (weatherappuser1 == null) { if (IsValidEmail(login.Email)) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(login.Email); mail.Subject = "Signup Confirmation from The WeatherMan App"; mail.Body = "This is for testing SMTP mail from GMAIL"; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "ABhi0912"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); Console.WriteLine("mail Send"); _weatherService.CreateUser(login); AuthController obj = new AuthController(); Token = obj.Login(login.Email); return(Ok(new { Email = login.Email, FirstName = login.FirstName, LastName = login.LastName, Token = Token })); } else { return(BadRequest(new { message = "Email Does not Exists please tru with different Email" })); } } else { WeatherAppUser weatherappuserexists = new WeatherAppUser(); return(BadRequest(new { message = "UserName Already Exists" })); } // return weatherappuser; }