コード例 #1
0
        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));
        }
コード例 #2
0
        public ActionResult Delete(int MinistryIncomeID)
        {
            ViewBag.MinistryIncomeID = MinistryIncomeID;
            ministryincome ministryincome = MinistryIncomeRepository.GetIncomeByID(MinistryIncomeID);

            return(View(ministryincome));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int MinistryIncomeID)
        {
            ministryincome ministryincome = MinistryIncomeRepository.GetIncomeByID(MinistryIncomeID);

            MinistryIncomeRepository.DeleteRecord(ministryincome);
            return(RedirectToAction("Index", new { ministryID = ministryincome.ministryID }));
        }
コード例 #4
0
        public ActionResult Edit(int MinistryIncomeID)
        {
            ministryincome ministryincome = MinistryIncomeRepository.GetIncomeByID(MinistryIncomeID);

            GetData(ministryincome.ministryID);
            GetData(ministryincome.ministryID);
            return(PartialView(ministryincome));
        }
コード例 #5
0
 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));
 }
コード例 #6
0
 public void DeleteRecord(ministryincome record)
 {
     myRecords.Remove(record);
     context.ministryincomes.Remove(record);
     context.SaveChanges();
 }
コード例 #7
0
 public ministryincome GetIncomeByID(int incomeID)
 {
     record = myRecords.FirstOrDefault(e => e.ministryIncomeID == incomeID);
     return(record);
 }
コード例 #8
0
 public void AddRecord(ministryincome Record)
 {
     myRecords.Add(record);
 }