public TaiKhoanConvert Get(string email, string provider) { TaiKhoanDAO tkO = new TaiKhoanDAO(); TaiKhoanConvert tk = new TaiKhoanConvert(); tk = tkO.getTaiKhoan(email, provider); return(tk); }
public TaiKhoanConvert Get(int IdUser) { if (Test() == false) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } TaiKhoanDAO tkO = new TaiKhoanDAO(); TaiKhoanConvert tk = new TaiKhoanConvert(); tk = tkO.getTaiKhoan(IdUser); //if (tk.Length == 0) // throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); return(tk); }
public bool Delete(int id) { //if (Test() == false) //{ // throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); //} TaiKhoanDAO tkO = new TaiKhoanDAO(); TaiKhoanConvert tk = new TaiKhoanConvert(); tk = tkO.getTaiKhoan(id); if (tk.IdUser == null) { return(false); } /*throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));*/ return(tkO.deleteTaiKhoan(id)); //False: Khi no la khoa ngoại. }
public bool ForegetPassword(string email) { String provider = "local"; string temp = CreatePassword(); MailMessage mailMessag = new MailMessage(ConfigurationManager.AppSettings.Get("Email"), email); mailMessag.Subject = "Gửi lại mật khẩu"; mailMessag.Body = "Mật khẩu mới của bạn là: " + temp; SmtpClient client = new SmtpClient(); client.Send(mailMessag); TaiKhoanDAO tkO = new TaiKhoanDAO(); TaiKhoanConvert tk = new TaiKhoanConvert(); tk = tkO.getTaiKhoan(email, provider); if (tk.IdUser == null) { return(false); } tkO.updatePassword(temp, tk.IdUser); return(true); }