public ActionResult Create([Bind(Include = "ExpensesId,Amount,date,Id")] Church_Income church_Income) { UserManager <ApplicationUser> usermanager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db)); var desc = db.typeOfIncomes.Find(church_Income.Id); var transaction = new Transactions() { //transId = 1, date = church_Income.date, amount = church_Income.Amount, transCode = "INC102", description = desc.description }; db.Transactions.Add(transaction); db.SaveChanges(); if (ModelState.IsValid) { db.church_Incomes.Add(church_Income); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id = new SelectList(db.typeOfIncomes, "Id", "description", church_Income.Id); return(View(church_Income)); }
public ActionResult DeleteConfirmed(int id) { Church_Income church_Income = db.church_Incomes.Find(id); db.church_Incomes.Remove(church_Income); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ExpensesId,Amount,date,Id")] Church_Income church_Income) { if (ModelState.IsValid) { db.Entry(church_Income).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id = new SelectList(db.typeOfIncomes, "Id", "description", church_Income.Id); return(View(church_Income)); }
// GET: Church_Income/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Church_Income church_Income = db.church_Incomes.Find(id); if (church_Income == null) { return(HttpNotFound()); } return(View(church_Income)); }
// GET: Church_Income/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Church_Income church_Income = db.church_Incomes.Find(id); if (church_Income == null) { return(HttpNotFound()); } ViewBag.Id = new SelectList(db.typeOfIncomes, "Id", "description", church_Income.Id); return(View(church_Income)); }