public ActionResult DeleteConfirmed(int id) { MonthlySpending monthlySpending = db.MonthlySpendings.Find(id); db.MonthlySpendings.Remove(monthlySpending); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MonthlySpendingID,FoodAmount,ClothesAmount,AlcoholAmount,OtherAmount,Date")] MonthlySpending monthlySpending) { if (ModelState.IsValid) { db.Entry(monthlySpending).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(monthlySpending)); }
public ActionResult Create([Bind(Include = "MonthlySpendingID,FoodAmount,ClothesAmount,AlcoholAmount,OtherAmount,Date")] MonthlySpending monthlySpending) { if (ModelState.IsValid) { db.MonthlySpendings.Add(monthlySpending); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(monthlySpending)); }
// GET: MonthlySpendings/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MonthlySpending monthlySpending = db.MonthlySpendings.Find(id); if (monthlySpending == null) { return(HttpNotFound()); } return(View(monthlySpending)); }