private void SendEmail(User user) { string email = user.UserEmail; List <User> users = LogicUser.GetAllUsers(); try { string subject = "Email Subject"; user.VerifyPassword = CreatePassword(6);; LogicUser.UpdateUser(user, user.UserId); string FromMail = "*****@*****.**"; string emailTo = email; MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress(FromMail); mail.To.Add(emailTo); mail.Subject = subject; mail.Body = user.VerifyPassword; SmtpServer.UseDefaultCredentials = true; SmtpServer.Port = 587; SmtpServer.Credentials = new NetworkCredential("*****@*****.**", "0533121776"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); } catch (Exception ex) { var x = ex.Message; } }
public HttpResponseMessage GetAllUsers() { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <List <User> >(LogicUser.GetAllUsers(), new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage GetUsersForTeamLeader(int TeamLeaderId) { List <User> users = LogicUser.GetAllUsers().Where(u => u.TeamLeaderId == TeamLeaderId).ToList(); return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <List <User> >(users, new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage VerifyEmail(string userName) { List <User> users = LogicUser.GetAllUsers(); user = users.FirstOrDefault(u => u.UserName == userName); if (user != null) { SendEmail(user); return(new HttpResponseMessage(HttpStatusCode.OK)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "error")); } }
public HttpResponseMessage VerifyPassword(string password, string userName) { List <User> users = LogicUser.GetAllUsers(); User user = users.FirstOrDefault(u => u.UserName == userName); var verifyPassword = user.VerifyPassword; if (password == verifyPassword) { return new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <User>(user, new JsonMediaTypeFormatter()) } } ; else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "error")); } }
public HttpResponseMessage CheckUserIp([FromBody] string ip) { List <User> users = LogicUser.GetAllUsers(); user = users.FirstOrDefault(u => u.UserIP == ip); if (user != null) { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <User>(user, new JsonMediaTypeFormatter()) }); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "error")); } }
public void SendEmail(string emailBody) { User user = LogicUser.GetAllUsers().FirstOrDefault(u => u.UserKindId == 1); _02_BLL.LogicEmail.SendEmail("Email Subject", emailBody, user.UserEmail); }