public bool DeleteContribution(Contribution contribution) { if (contribution == null) return false; _unitOfWork.ContributionRepository.Delete(contribution); _unitOfWork.Save(); return true; }
public bool EditContribution(Contribution contribution) { _unitOfWork.ContributionRepository.Edit(contribution); _unitOfWork.Save(); return true; }
public bool AddContribution(Contribution contribution) { _unitOfWork.ContributionRepository.Add(contribution); _unitOfWork.Save(); return true; }
private IEnumerable<InKindContributionDetailViewModel> GetInKindContributionDetail(Contribution contribution) { var inkindContributionDetails = contribution.InKindContributionDetails; return (from inkindContributionDetail in inkindContributionDetails select new InKindContributionDetailViewModel() { InKindContributionDetailID = inkindContributionDetail.InKindContributionDetailID, ContributionID = inkindContributionDetail.ContributionID, ReferencNumber = inkindContributionDetail.ReferenceNumber, ContributionDate = inkindContributionDetail.ContributionDate, Commodity = inkindContributionDetail.Commodity.Name, CommodityID = inkindContributionDetail.CommodityID, Amount = inkindContributionDetail.Amount }); }
private IEnumerable<ContributionDetailViewModel> GetContributionDetail(Contribution contribution) { var contributionDetail = contribution.ContributionDetails; return (from contributionDetails in contributionDetail select new ContributionDetailViewModel() { ContributionDetailID = contributionDetails.ContributionDetailID, ContributionID = contributionDetails.ContributionID, CurrencyID = contributionDetails.CurrencyID, Currency = contributionDetails.Currency.Name, PledgeReferenceNumber = contributionDetails.PledgeReferenceNo, PledgeDate = contributionDetails.PledgeDate, Amount = contributionDetails.Amount, PledgeDatePref = contributionDetails.PledgeDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()) }); }
public ActionResult Create(Contribution contribution) { if (contribution != null && ModelState.IsValid) { contribution.Year = DateTime.Now.Year; _contributionService.AddContribution(contribution); if (contribution.ContributionType == "In-Kind") return RedirectToAction("InkindDetails", "Contribution", new { id = contribution.ContributionID }); return RedirectToAction("Details", "Contribution", new { id = contribution.ContributionID }); } ViewBag.HRDID = new SelectList(_hrdService.GetAllHRD(), "HRDID", "Year", contribution.HRDID); ViewBag.DonorID = new SelectList(_donorService.GetAllDonor(), "DonorID", "Name", contribution.DonorID); ViewBag.Year = contribution.Year; return View(contribution); }
public ActionResult Create() { var contribution = new Contribution(); var hrds = _hrdService.GetAllHRD(); var hrdName = (from item in hrds select new { item.HRDID, Name = string.Format("{0}-{1}", item.Season.Name, item.Year) }).ToList (); ViewBag.HRDID = new SelectList(hrdName, "HRDID", "Name"); //ViewBag.HRDID = new SelectList(_hrdService.GetAllHRD(), "HRDID", "Year"); ViewBag.DonorID = new SelectList(_donorService.GetAllDonor(), "DonorID", "Name"); ViewBag.Year = DateTime.Now.Year; return View(contribution); }