예제 #1
0
        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));
        }
예제 #2
0
        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"));
            }
        }
예제 #3
0
        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());
        }
예제 #4
0
        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());
        }