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 }); }
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 }); }
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 }; }
internal bool UpdateDonor(DonorModel model) { Donor donor = DonorMapper.DonorModelToDonor(model); bool isUpdated = donorsRepo.Update(donor); return isUpdated; }
internal DonorModel AddDonor(DonorModel model) { Donor donor = DonorMapper.DonorModelToDonor(model); Donor addedDonor = donorsRepo.Add(donor); return DonorMapper.DonorToDonorModel(addedDonor); }