public ActionResult Create(ministryincome ministryincome) { try { if (ministryincome.Comment == null) { ministryincome.Comment = ""; } if (ModelState.IsValid) { db.ministryincomes.Add(ministryincome); db.SaveChanges(); MinistryIncomeRepository.AddRecord(ministryincome); TempData["Message2"] = "Ministry income record added successfully."; return(RedirectToAction("Create", new { ministryID = ministryincome.ministryID })); } } catch (Exception ex) { TempData["Message2"] = "Error adding ministry income record"; } GetData(ministryincome.ministryID); return(PartialView(ministryincome)); }
public ActionResult Delete(int MinistryIncomeID) { ViewBag.MinistryIncomeID = MinistryIncomeID; ministryincome ministryincome = MinistryIncomeRepository.GetIncomeByID(MinistryIncomeID); return(View(ministryincome)); }
public ActionResult DeleteConfirmed(int MinistryIncomeID) { ministryincome ministryincome = MinistryIncomeRepository.GetIncomeByID(MinistryIncomeID); MinistryIncomeRepository.DeleteRecord(ministryincome); return(RedirectToAction("Index", new { ministryID = ministryincome.ministryID })); }
public ActionResult Edit(int MinistryIncomeID) { ministryincome ministryincome = MinistryIncomeRepository.GetIncomeByID(MinistryIncomeID); GetData(ministryincome.ministryID); GetData(ministryincome.ministryID); return(PartialView(ministryincome)); }
public ActionResult Edit(ministryincome ministryincome) { try { //if (contribution.CheckNumber == null) { contribution.CheckNumber = ""; } if (ModelState.IsValid) { db.Entry(ministryincome).State = EntityState.Modified; db.SaveChanges(); TempData["Message2"] = string.Format("Ministry income update successfully."); GetData(ministryincome.ministryID); return(RedirectToAction("Details", new { ministryID = ministryincome.ministryID })); } } catch (Exception ex) { TempData["Message2"] = string.Format("Error editing {0} ministry income record.", ministryincome.Title); } GetData(ministryincome.ministryID); return(PartialView(ministryincome)); }
public void DeleteRecord(ministryincome record) { myRecords.Remove(record); context.ministryincomes.Remove(record); context.SaveChanges(); }
public ministryincome GetIncomeByID(int incomeID) { record = myRecords.FirstOrDefault(e => e.ministryIncomeID == incomeID); return(record); }
public void AddRecord(ministryincome Record) { myRecords.Add(record); }