public ActionResult DangKi(taikhoan tk) { var data = new TaikhoanController().InsertElement(tk); if (data == true) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public JsonResult UpdateMatKhau(taikhoan tk) { tk.id = ((taikhoan)Session[CommonConstants.SESSION_ACCOUNT]).id; bool kq = new TaikhoanController().UpdateMatKhau(tk); if (kq == true) { return(Json("Cap Nhap Thanh cong", JsonRequestBehavior.AllowGet)); } return(Json("Cap nhat khong thanh cong", JsonRequestBehavior.AllowGet)); }
/// <summary> /// /AuthCallback/IndexAsync /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <ActionResult> IndexAsync(CancellationToken cancellationToken) { var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()). AuthorizeAsync(cancellationToken); if (result.Credential != null) { var service = new PlusService(new BaseClientService.Initializer { HttpClientInitializer = result.Credential, ApplicationName = "ASP.NET MVC Sample" }); // YOUR CODE SHOULD BE HERE.. // SAMPLE CODE: Person me = service.People.Get("me").Execute(); if (me != null) { taikhoan taik = new TaikhoanController().CheckGoole(me.Id); if (taik == null) { taikhoan taikhoan = new taikhoan() { email = me.Emails.ElementAt(0).Value, GoogleID = me.Id, hinhanh = me.Image.Url, }; bool resutl = new TaikhoanController().DangNhapGoogle(taikhoan); Session.Add(CommonConstants.SESSION_ACCOUNT, taikhoan); if (Session["CurrentUrl"] != null) { return(Redirect((string)Session["CurrentUrl"])); } return(RedirectToAction("Index", "QuanLy")); } Session.Add(CommonConstants.SESSION_ACCOUNT, taik); return(RedirectToAction("Index", "QuanLy")); } // ViewBag.Message = "FILE COUNT IS: " + list.Items.Count(); return(RedirectToAction("Index")); } else { return(new RedirectResult(result.RedirectUri)); } }
// GET: LoginUser #region Đăng Nhập public JsonResult DangNhap(taikhoan tk) { if (ModelState.IsValid) { taikhoan user = new TaikhoanController().CheckElement(tk); if (user != null) { Session.Add(CommonConstants.SESSION_ACCOUNT, user); FormsAuthentication.SetAuthCookie(tk.nguoidung, true); return(Json(true, JsonRequestBehavior.AllowGet)); } } return(Json(false, JsonRequestBehavior.AllowGet)); }
public ActionResult DangNhap(taikhoan tk) { var data = new TaikhoanController().CheckElement(tk); if (ModelState.IsValid) { if (data != null) { Session.Add(CommonConstants.SESSION_ACCOUNT, data); FormsAuthentication.SetAuthCookie(data.nguoidung, true); return(RedirectToAction("Index", "QuanLy")); } } return(RedirectToAction("Index")); }
public ActionResult UpdateHinhanh(HttpPostedFileBase file) { taikhoan tk = new taikhoan(); tk.id = ((taikhoan)Session[CommonConstants.SESSION_ACCOUNT]).id; string gui = Guid.NewGuid().ToString(); string Filename = gui + Path.GetFileName(file.FileName); string path = Path.Combine(Server.MapPath("/Areas/Admin/containt/Image/"), Filename); file.SaveAs(path); tk.hinhanh = "/Areas/Admin/containt/Image/" + Filename; bool kq = new TaikhoanController().UpdateHinhAnh(tk); if (kq == true) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Dangki(taikhoan tk) { if (ModelState.IsValid) { bool kt = new TaikhoanController().KiemTraTenDangKi(tk.nguoidung); if (kt == false) { tk.id = Guid.NewGuid(); tk.Quyen = 0; bool kq = new TaikhoanController().DangKiUserKhach(tk); string d = Url.Action("Actived", "LoginUser", new { id = tk.id }, Request.Url.Scheme); string link = string.Format("Dear {0}<BR/>Thank you for your registration, please click on the below link to comlete your registration: <a href=\"{1}\" title=\"User Email Confirm\">{1}</a>", tk.nguoidung, Url.Action("Actived", "LoginUser", new { id = tk.id }, Request.Url.Scheme)); bool b = new SMTPMail().sendmail(tk.email, "chúc mừng bạn ", link, null); } } return(RedirectToAction("Index", "Home")); }