public bool ForgetPassword_Email(string email) { var user = CheckEmailExists(email); var recovery = GenerateKey(); if (user != null) { // Sending Email _Mail mail = new _Mail(); mail.Reciver = email; mail.Subject = "Password Recovery"; mail.Message = "Use the following link to recover <br/>" + "Link: http://localhost:52189/UpdatePassword/" + recovery; mail.Send(); // Database Entry using (var db = new TESDataContext()) { var log = (from u in db.User_Informations where u.user_id == user.UserId select u).FirstOrDefault(); log.password_recovery = recovery; db.SubmitChanges(); } return(true); } return(false); }
// Request Supervisor public void SelectSupervisor(string email, long?id) { // Sending Email _Mail mail = new _Mail(); mail.Reciver = email; mail.Subject = "Supervisor Request"; mail.Message = "Will you be my supervisor? <br/>" + this.User.FullName; mail.Send(); // Database Entry using (var db = new TESDataContext()) { var log = new Student_Supervisor { student_id = this.StudentId, supervisor_id = id, supervise = null, }; db.Student_Supervisors.InsertOnSubmit(log); db.SubmitChanges(); } }