public IActionResult Add(Donor d)
        {
            if (!ModelState.IsValid)    // If there were validation errors, IsValid will be false.
            {
                return(View(d));
            }


            _donorService.AddDonor(d);
            _donorService.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
Example #2
0
        public ActionResult Donor_Create([DataSourceRequest] DataSourceRequest request, DonorModel donor)
        {
            if (donor != null && ModelState.IsValid)
            {
                _donorService.AddDonor(BindDonor(donor));
            }

            return(Json(new[] { donor }.ToDataSourceResult(request, ModelState)));
        }
Example #3
0
        public ActionResult Create(Donor donor)
        {
            if (ModelState.IsValid)
            {
                _donorService.AddDonor(donor);
                return(Json(new { success = true }));
            }

            return(PartialView(donor));
        }
Example #4
0
 public async Task <bool> SubmitDonorData(DonorViewModel donorData)
 {
     return(await donorService.AddDonor(donorData));
 }