public ActionResult Donations_UpdateById([DataSourceRequest] DataSourceRequest request, Donation donation, int id) { var modelStateErrors = this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors); if (modelStateErrors.Count() > 0) { foreach (var ert in modelStateErrors) { ModelState.AddModelError("error -", ert.ErrorMessage); } } if (ModelState.IsValid) { // var donations = _Service.GetDonationsById(id); var entity = _Service.GetDonationById(id); entity.Id = donation.Id; entity.SponsorId = donation.SponsorId; entity.DonationAmount = donation.DonationAmount; entity.DonationDate = donation.DonationDate; entity.DonationFor = donation.DonationFor; entity.DonationType = donation.DonationType; entity.PaymentCategory = donation.PaymentCategory; entity.PaymentMethod = donation.PaymentMethod; entity.Notes = donation.Notes; entity.LastUpdated = DateTime.Now; entity.LastUpdatedBy = User.Identity.Name; _Service.Save(entity); } return(Json(new[] { donation }.ToDataSourceResult(request, ModelState))); }