public void runStates()
        {
            GenericClass obj = new GenericClass();

            var nextpageurl = "http://www.mapsofindia.com/villages/data.php?state=all";
            var webpage     = obj.GetWebPage(nextpageurl);


            IList <MasterDataJson> persons = new JavaScriptSerializer().Deserialize <IList <MasterDataJson> >(webpage);

            for (int i = 0; i < persons.Count; i++)
            {
                using (var context = new MasterDataEntities())
                {
                    var t = new tbl_state
                    {
                        stateId   = Convert.ToInt16(persons[i].value),
                        stateName = persons[i + 1].text
                    };
                    context.tbl_state.Add(t);
                    context.SaveChanges();
                }

                i = i + 1;
            }
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_state tbl_state = db.tbl_state.Find(id);

            db.tbl_state.Remove(tbl_state);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult Delete(Int16 id)
        {
            tbl_state tb = db.tbl_states.Where(x => x.state_id == id).Single <tbl_state>();

            db.tbl_states.DeleteOnSubmit(tb);
            db.SubmitChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,subject,active")] tbl_state tbl_state)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_state).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_state));
 }
Exemplo n.º 5
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"));
        }
Exemplo n.º 6
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"));
        }
Exemplo n.º 7
0
        public ActionResult Create([Bind(Include = "Id,subject,active")] tbl_state tbl_state)
        {
            if (ModelState.IsValid)
            {
                db.tbl_state.Add(tbl_state);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tbl_state));
        }
Exemplo n.º 8
0
        // GET: state/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_state tbl_state = db.tbl_state.Find(id);

            if (tbl_state == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_state));
        }
 partial void Deletetbl_state(tbl_state instance);
 partial void Updatetbl_state(tbl_state instance);
 partial void Inserttbl_state(tbl_state instance);