public ActionResult Edit(Donor donor) { if (ModelState.IsValid && _donorService.IsCodeValid(donor.DonorCode,donor.DonorID)) { _donorService.EditDonor(donor); return Json(new { success = true }); } return PartialView(donor); }
public ActionResult Create(Donor donor) { if (ModelState.IsValid) { _donorService.AddDonor(donor); return Json(new { success = true }); } return PartialView(donor); }
public void CanCreatePostBack() { //ACT var donor = new Donor { Name = "USAID", DonorCode = "UAD", IsResponsibleDonor = false, IsSourceDonor = true, LongName = "United States Agency For International Development" }; var jsonResult = _donorController.Create(donor) as JsonResult; Assert.NotNull(jsonResult); dynamic data = jsonResult.Data; Assert.AreEqual(true, data.success); }