public ActionResult Login(AppUser item) { ViewData["product"] = ps.GetAll(); ViewData["category"] = cs.GetAll(); ViewData["subcategory"] = ss.GetAll(); ViewData["thirdcategory"] = ts.GetAll(); ViewBag.ProductImage = imgs.GetAll(); if (aus.Any(m => m.UserName == item.UserName && m.Password == item.Password)) { AppUser gelen = aus.GetByDefault(m => m.UserName == item.UserName); ViewBag.Username = gelen.Name; if (gelen.IsPageAdmin == true || gelen.IsAdministrator == true) { Session["admin"] = gelen; Session.Timeout = 10; return(RedirectToAction("Index", "MyPage")); } Session["oturum"] = gelen; Session.Timeout = 10; return(RedirectToAction("Index", "MyPage")); } else { ViewBag.Message = "Lütfen girmiş olduğunuz bilgileri kontrol ediniz"; } return(View()); }
public ActionResult Index() { ViewData["product"] = ps.GetAll(); ViewData["category"] = cs.GetAll(); ViewData["subcategory"] = ss.GetAll(); ViewData["subcategoryE"] = ss.GetAll(); ViewData["thirdcategory"] = ts.GetAll(); ViewData["ProductImage"] = imgs.GetAll(); if (Session["oturum"] != null) { AppUser gelen = (AppUser)Session["oturum"]; ViewBag.AppUserID = gelen.ID; TempData["appuserID"] = gelen.ID; return(View(Tuple.Create <List <UrunSepeti>, List <ShoppingCart> >((List <UrunSepeti>)Session["sepet"], scs.GetDefault(m => m.AppUserID == gelen.ID && m.Status != Core.Entity.Enum.Status.Deleted)))); } else if (Session["admin"] != null) { AppUser gelen = (AppUser)Session["admin"]; ViewBag.AppUserID = gelen.ID; TempData["appuserID"] = gelen.ID; return(View(Tuple.Create <List <UrunSepeti>, List <ShoppingCart> >((List <UrunSepeti>)Session["sepet"], scs.GetDefault(m => m.AppUserID == gelen.ID && m.Status != Core.Entity.Enum.Status.Deleted)))); } return(View(Tuple.Create <List <UrunSepeti>, List <ShoppingCart> >((List <UrunSepeti>)Session["sepet"], scs.GetDefault(m => m.Status == Core.Entity.Enum.Status.None)))); }