示例#1
0
        public IHttpActionResult PostStates_Table(States_Table states_Table)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.States_Table.Add(states_Table);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (States_TableExists(states_Table.States_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = states_Table.States_ID }, states_Table));
        }
示例#2
0
        public IHttpActionResult PutStates_Table(int id, States_Table states_Table)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != states_Table.States_ID)
            {
                return(BadRequest());
            }

            db.Entry(states_Table).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!States_TableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            States_Table states_Table = db.States_Table.Find(id);

            db.States_Table.Remove(states_Table);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "States_ID,Gov_ID,States_Name,States_Desc,States_X_Point,States_Y_Point")] States_Table states_Table)
 {
     if (ModelState.IsValid)
     {
         db.Entry(states_Table).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Governorate_Table = db.Governorate_Table.ToList();
     return(View(states_Table));
 }
示例#5
0
        public IHttpActionResult GetStates_Table(int id)
        {
            States_Table states_Table = db.States_Table.Find(id);

            if (states_Table == null)
            {
                return(NotFound());
            }

            return(Ok(states_Table));
        }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            States_Table states_Table = db.States_Table.Find(id);

            if (states_Table == null)
            {
                return(HttpNotFound());
            }
            return(View(states_Table));
        }
示例#7
0
        public IHttpActionResult DeleteStates_Table(int id)
        {
            States_Table states_Table = db.States_Table.Find(id);

            if (states_Table == null)
            {
                return(NotFound());
            }

            db.States_Table.Remove(states_Table);
            db.SaveChanges();

            return(Ok(states_Table));
        }
        // GET: States_Table/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            States_Table states_Table = db.States_Table.Find(id);

            if (states_Table == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Governorate_Table = db.Governorate_Table.ToList();

            return(View(states_Table));
        }