//SignUP public LoginResponse CreateUser(LoginResponse login) { WeatherAppUser obj = new WeatherAppUser(); obj.username = login.username; obj.password = login.password; _Weather.InsertOne(obj); return(login); }
//SignUP public LoginResponse CreateUser(LoginResponse login) { WeatherAppUser obj = new WeatherAppUser(); obj.Email = login.Email; obj.Password = login.Password; obj.FirstName = login.FirstName; obj.LastName = login.LastName; _Weather.InsertOne(obj); return(login); }
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; }
public void Update(string Email, WeatherAppUser weatherappuserIn) => _Weather.ReplaceOne(weatherappuser => weatherappuser.Email == Email, weatherappuserIn);
//Login public WeatherAppUser CreateLogin(WeatherAppUser weatherappuser) { _Weather.InsertOne(weatherappuser); return(weatherappuser); }