public ActionResult Create([Bind(Include = "ExpensesId,Amount,date,Id,total")] Church_Expenses church_Expenses) { UserManager <ApplicationUser> usermanager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db)); var desc = db.typeOfExpense_Incomes.Find(church_Expenses.Id); var transaction = new Transactions() { //transId = 1, date = church_Expenses.date, amount = church_Expenses.Amount, transCode = "EXP101", description = desc.description }; db.Transactions.Add(transaction); db.SaveChanges(); if (ModelState.IsValid) { db.Church_Expenses.Add(church_Expenses); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id = new SelectList(db.typeOfExpense_Incomes, "Id", "description", church_Expenses.Id); return(View(church_Expenses)); }
public ActionResult DeleteConfirmed(int id) { Church_Expenses church_Expenses = db.Church_Expenses.Find(id); db.Church_Expenses.Remove(church_Expenses); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ExpensesId,Amount,date,Id,total")] Church_Expenses church_Expenses) { if (ModelState.IsValid) { db.Entry(church_Expenses).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id = new SelectList(db.typeOfExpense_Incomes, "Id", "description", church_Expenses.Id); return(View(church_Expenses)); }
// GET: Church_Expenses/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Church_Expenses church_Expenses = db.Church_Expenses.Find(id); if (church_Expenses == null) { return(HttpNotFound()); } return(View(church_Expenses)); }
// GET: Church_Expenses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Church_Expenses church_Expenses = db.Church_Expenses.Find(id); if (church_Expenses == null) { return(HttpNotFound()); } ViewBag.Id = new SelectList(db.typeOfExpense_Incomes, "Id", "description", church_Expenses.Id); return(View(church_Expenses)); }
public ActionResult FinanceView(DateTime startdate, DateTime enddate) { var transaction = new Transactions(); var expense = new Church_Expenses(); ViewBag.SumOfExpenses = expense.SumOfExpenses(); ViewBag.Income = transaction.Income(); var trans = from x in db.Transactions select x; //if (Session != null) //{ //if (startdate != null && enddate != null) //{ return(View(db.Transactions.ToList().Where(x => (startdate <= x.date) && (enddate >= x.date)).ToList())); }