public ActionResult Logout() { int cout = 0; HttpCookie langCookie = Request.Cookies["lang_client"]; while (langCookie != null) { langCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(langCookie); cout++; if (cout == 10) { break; } } cout = 0; HttpCookie nameCookie = Request.Cookies["name_client"]; while (nameCookie != null) { nameCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(nameCookie); cout++; if (cout == 10) { break; } } CurrentSession.ClearAll(); return(RedirectToAction("Index")); }
public ActionResult Detail(int Id) { var db = new MyDbDataContext(); string cookieClient = Request.Cookies["name_client"].Value; string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true); string userName = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||")); var user = db.Users.FirstOrDefault(a => a.UserName == userName); if (user.UserContent == true) { int cout = 0; HttpCookie langCookie = Request.Cookies["lang_client"]; while (langCookie != null) { langCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(langCookie); cout++; if (cout == 10) { break; } } cout = 0; HttpCookie nameCookie = Request.Cookies["name_client"]; while (nameCookie != null) { nameCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(nameCookie); cout++; if (cout == 10) { break; } } CurrentSession.ClearAll(); return(Redirect("http://swallowtravel.com/admin")); } BookTour detail = db.BookTours.FirstOrDefault(a => a.ID == Id); if (detail == null) { TempData["Messages"] = "does not exist"; return(RedirectToAction("Index")); } return(View("Detail", detail)); }
public ActionResult Create() { var db = new MyDbDataContext(); string cookieClient = Request.Cookies["name_client"].Value; string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true); string userName = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||")); var user = db.Users.FirstOrDefault(a => a.UserName == userName); if (user.UserContent == true) { int cout = 0; HttpCookie langCookie = Request.Cookies["lang_client"]; while (langCookie != null) { langCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(langCookie); cout++; if (cout == 10) { break; } } cout = 0; HttpCookie nameCookie = Request.Cookies["name_client"]; while (nameCookie != null) { nameCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(nameCookie); cout++; if (cout == 10) { break; } } CurrentSession.ClearAll(); return(Redirect("http://swallowtravel.com/admin")); } ViewBag.Title = "Add Promotion"; LoadData(); var Pro = new EPromotionCode(); return(View(Pro)); }
public ActionResult Update(int id) { var db = new MyDbDataContext(); string cookieClient = Request.Cookies["name_client"].Value; string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true); string userName = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||")); var user = db.Users.FirstOrDefault(a => a.UserName == userName); if (user.UserContent == true) { int cout = 0; HttpCookie langCookie = Request.Cookies["lang_client"]; while (langCookie != null) { langCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(langCookie); cout++; if (cout == 10) { break; } } cout = 0; HttpCookie nameCookie = Request.Cookies["name_client"]; while (nameCookie != null) { nameCookie.Expires = DateTime.Now.AddDays(-30); HttpContext.Response.Cookies.Add(nameCookie); cout++; if (cout == 10) { break; } } CurrentSession.ClearAll(); return(Redirect("http://swallowtravel.com/admin")); } ViewBag.Title = "Udpate Promotion"; PromotionCode detailPro = db.PromotionCodes.FirstOrDefault(a => a.ID == id); if (detailPro == null) { TempData["Messages"] = "Does not exist"; return(RedirectToAction("Index")); } LoadData(); var pro = new EPromotionCode { Code = detailPro.Code, Rate = detailPro.Rate, StartDay = detailPro.StartDay, EndDay = detailPro.EndDay, Status = detailPro.Status, Total = detailPro.Total, Description = detailPro.Description, Used = detailPro.Used, }; return(View(pro)); }