コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CityPrice cityPrice = db.CityPrices.Find(id);

            db.CityPrices.Remove(cityPrice);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Price")] CityPrice cityPrice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cityPrice).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cityPrice));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Price")] CityPrice cityPrice)
        {
            if (ModelState.IsValid)
            {
                db.CityPrices.Add(cityPrice);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cityPrice));
        }
コード例 #4
0
        // GET: CityPrices/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CityPrice cityPrice = db.CityPrices.Find(id);

            if (cityPrice == null)
            {
                return(HttpNotFound());
            }
            return(View(cityPrice));
        }