public ActionResult DeleteConfirmed(int id) { Crepe crepe = db.Crepes.Find(id); db.Crepes.Remove(crepe); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
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(); }
// 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)); }