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")); }
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))); }
public ActionResult Create(Donor donor) { if (ModelState.IsValid) { _donorService.AddDonor(donor); return(Json(new { success = true })); } return(PartialView(donor)); }
public async Task <bool> SubmitDonorData(DonorViewModel donorData) { return(await donorService.AddDonor(donorData)); }