public ActionResult Index_Get() { ShopingContext shopingContext = new ShopingContext(); int c_id = 0; try { c_id = ((Ecommerce.Models.Register.RegisterPro)Session["userId"]).Id; getCountry(); } catch { Response.Redirect("~/Home/"); } RegisterPro regpro = shopingContext.registerPro.Where(x => x.Id == c_id).FirstOrDefault(); GetState(regpro.countryId); return(View(regpro)); }
public ActionResult Index_Post() { LoginBean loginBean = new LoginBean(); TryUpdateModel(loginBean); if (ModelState.IsValid) { ShopingContext shopingContext = new ShopingContext(); RegisterPro loginsuccess = shopingContext.registerPro.Single(x => x.email == loginBean.email && x.password == loginBean.password && x.UserType == "user"); loginsuccess = loginsuccess == null ? null : loginsuccess; Session["userId"] = loginsuccess; } if (Session["userId"] == null) { return(View()); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Index_Post(string statesId) { if (statesId == null) { getCountry(); return(View()); } ShopingContext shopingContext = new ShopingContext(); RegisterPro reg = new RegisterPro(); reg.statesId = int.Parse(statesId); reg.UserType = "user"; TryUpdateModel(reg); if (ModelState.IsValid) { //Add or Inser Data In DataBase shopingContext.Entry(reg).State = System.Data.EntityState.Modified; shopingContext.SaveChanges(); } getCountry(); GetState(reg.countryId); return(View()); }
public ActionResult Index_Post(string StateID) { if (StateID == null) { getCountry(); return(View()); } ShopingContext shopingContext = new ShopingContext(); RegisterPro reg = new RegisterPro(); reg.statesId = int.Parse(StateID); reg.UserType = "user"; TryUpdateModel(reg); if (ModelState.IsValid) { //Add or Inser Data In DataBase shopingContext.registerPro.Add(reg); shopingContext.SaveChanges(); } getCountry(); return(View()); }