public ActionResult DeleteConfirmed(int id) { CANDY cANDY = db.CANDies.Find(id); db.CANDies.Remove(cANDY); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID_CANDY,NAME,TYPE,PRICE,IMAGE")] CANDY cANDY) { if (ModelState.IsValid) { db.Entry(cANDY).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cANDY)); }
public ActionResult Create([Bind(Include = "ID_CANDY,NAME,TYPE,PRICE,IMAGE")] CANDY cANDY) { if (ModelState.IsValid) { db.CANDies.Add(cANDY); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cANDY)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CANDY cANDY = db.CANDies.Find(id); if (cANDY == null) { return(HttpNotFound()); } return(View(cANDY)); }
private static void Main() { int packetCount; while ((packetCount = int.Parse(Console.ReadLine())) != -1) { int[] packetCandyCounts = new int[packetCount]; for (int i = 0; i < packetCount; ++i) { packetCandyCounts[i] = int.Parse(Console.ReadLine()); } Console.WriteLine( CANDY.Solve(packetCandyCounts)); } }