示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Crepe crepe = db.Crepes.Find(id);

            db.Crepes.Remove(crepe);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "ID,Type,NormalPrice,XLPrice")] Crepe crepe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(crepe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(crepe));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "ID,Type,NormalPrice,XLPrice")] Crepe crepe)
        {
            if (ModelState.IsValid)
            {
                db.Crepes.Add(crepe);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(crepe));
        }
示例#4
0
        public void addCrepeToCrepes(string crepeType, string ingredientsToString, string normalPrice, string XLPrice)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            Crepe crepe             = new Crepe();

            crepe.Ingredients = ingredientsToString;
            crepe.Type        = crepeType;
            crepe.NormalPrice = normalPrice;
            crepe.XLPrice     = XLPrice;
            db.Crepes.Add(crepe);
            db.SaveChanges();
        }
示例#5
0
        // GET: Crepes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Crepe crepe = db.Crepes.Find(id);

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