Ejemplo n.º 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 });
        }
Ejemplo n.º 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 });

        }
Ejemplo n.º 3
0
        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

            };
        }
Ejemplo n.º 4
0
 internal bool UpdateDonor(DonorModel model)
 {
     Donor donor = DonorMapper.DonorModelToDonor(model);
     bool isUpdated = donorsRepo.Update(donor);
     return isUpdated;
 }
Ejemplo n.º 5
0
 internal DonorModel AddDonor(DonorModel model)
 {
     Donor donor = DonorMapper.DonorModelToDonor(model);
     Donor addedDonor = donorsRepo.Add(donor);
     return DonorMapper.DonorToDonorModel(addedDonor);
 }