public ActionResult Users_Update([DataSourceRequest]DataSourceRequest request, VolunteerInputModel volunteer) { if (this.ModelState.IsValid) { var entity = this.volunteers.GetById(volunteer.Id); entity.UserName = volunteer.UserName; entity.Email = volunteer.Email; entity.FirstName = volunteer.FirstName; entity.LastName = volunteer.LastName; entity.Description = volunteer.Description; entity.Age = volunteer.Age; this.volunteers.Save(); } var volunteerToDisplay = this.volunteers .GetAll() .To<VolunteerViewModel>() .FirstOrDefault(x => x.Id == volunteer.Id); return this.Json(new[] { volunteerToDisplay }.ToDataSourceResult(request, this.ModelState)); }
public ActionResult Users_Update([DataSourceRequest] DataSourceRequest request, VolunteerInputModel volunteer) { if (this.ModelState.IsValid) { var entity = this.volunteers.GetById(volunteer.Id); entity.UserName = volunteer.UserName; entity.Email = volunteer.Email; entity.FirstName = volunteer.FirstName; entity.LastName = volunteer.LastName; entity.Description = volunteer.Description; entity.Age = volunteer.Age; this.volunteers.Save(); } var volunteerToDisplay = this.volunteers .GetAll() .To <VolunteerViewModel>() .FirstOrDefault(x => x.Id == volunteer.Id); return(this.Json(new[] { volunteerToDisplay }.ToDataSourceResult(request, this.ModelState))); }