public ActionResult KeepOld(bool keep) { if (!LS.isHaveID()) { return(Json(new { result = "error", action = "login", message = "You must login first" })); } if (LS.CurrentHttpContext.Request.Cookies["SALcart"] != null) { //retrieve old cart var oldGuid = new Guid(LS.CurrentHttpContext.Request.Cookies["SALcart"].Value); if (keep) { ShoppingCartService.MigrateShoppingCart(oldGuid, LS.CurrentUser.ID); } else { //remove old var forRemove = _db.ShoppingCartItems.Where(x => x.UserID == oldGuid).ToList(); _db.ShoppingCartItems.RemoveRange(forRemove); _db.SaveChanges(); } LS.DeleteCookie("SALcart"); } return(Json(new { result = "ok" })); }
public ActionResult LogOff() { FormsAuthentication.SignOut(); LS.DeleteCookie(LS.cookiename); LS.DeleteCookie(LS.cookieOldCartname); Session.Abandon(); if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.ToString())); } return(RedirectToAction("DomainPage", "Page", new { name = "root" })); }