Beispiel #1
0
        public ActionResult Delete(Int32 id)
        {
            Model_State obj = db.tbl_states.Where(x => x.state_id == id).Select(x => new Model_State()
            {
                state_id   = x.state_id,
                country_id = x.country_id,
                state_name = x.state_name
            }).SingleOrDefault();

            return(View(obj));
        }
Beispiel #2
0
        public ActionResult Edit(Model_State obj)
        {
            tbl_state tb = db.tbl_states.Where(x => x.state_id == obj.state_id).Single <tbl_state>();

            tb.state_id   = obj.state_id;
            tb.country_id = obj.country_id;
            tb.state_name = obj.state_name;
            db.SubmitChanges();

            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult Create(Model_State obj)
        {
            tbl_state tb = new tbl_state();

            tb.country_id = obj.country_id;
            tb.state_name = obj.state_name;
            db.tbl_states.InsertOnSubmit(tb);
            db.SubmitChanges();

            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult Edit(int id)
        {
            Model_State obj = db.tbl_states.Where(x => x.state_id == id).Select(x => new Model_State()
            {
                state_id   = x.state_id,
                country_id = x.country_id,
                state_name = x.state_name
            }).SingleOrDefault();

            ViewBag.countryid = new SelectList(db.tbl_countries.ToList(), "country_id", "country_name", obj.country_id);
            return(View(obj));
        }