コード例 #1
0
        public ActionResult Create(DonorModel model)
        {
            List<string> titles = new List<string> { "Mr", "Mrs", "Miss", "Ms", "Dr", "Eng", "Prof", "Rev" };
            ViewBag.Titles = new SelectList(titles);
            ViewBag.Countries = new SelectList(GetAllCountries());
            if (!ModelState.IsValid)
                return View(model);

            DonorModel addedDonor = donorsBLL.AddDonor(model);
            return RedirectToAction("Create", new { status = ActionStatus.Success });
        }
コード例 #2
0
        public ActionResult Modify(DonorModel model)
        {
            List<string> titles = new List<string> { "Mr", "Mrs", "Miss", "Ms", "Dr", "Eng", "Prof", "Rev" };
            ViewBag.Titles = new SelectList(titles);
            ViewBag.Countries = new SelectList(GetAllCountries());
            if (!ModelState.IsValid)
                return View(model);

            bool isUpdated = donorsBLL.UpdateDonor(model);

            return RedirectToAction("Modify", new { status = ActionStatus.Success });

        }
コード例 #3
0
ファイル: DonorMapper.cs プロジェクト: majurans/OialCharity
        public static Donor DonorModelToDonor(DonorModel donorModel)
        {
            return new Donor
            {
                Email = donorModel.Email,
                FirstName = donorModel.FirstName,
                Id = donorModel.Id,
                Initials = donorModel.Initials,
                LastName = donorModel.LastName,
                Telephone = donorModel.Telephone,
                Title = donorModel.Title,
                Country = donorModel.Country

            };
        }
コード例 #4
0
ファイル: DonorBLL.cs プロジェクト: majurans/OialCharity
 internal bool UpdateDonor(DonorModel model)
 {
     Donor donor = DonorMapper.DonorModelToDonor(model);
     bool isUpdated = donorsRepo.Update(donor);
     return isUpdated;
 }
コード例 #5
0
ファイル: DonorBLL.cs プロジェクト: majurans/OialCharity
 internal DonorModel AddDonor(DonorModel model)
 {
     Donor donor = DonorMapper.DonorModelToDonor(model);
     Donor addedDonor = donorsRepo.Add(donor);
     return DonorMapper.DonorToDonorModel(addedDonor);
 }