public ActionResult UpdateH([DataSourceRequest] DataSourceRequest request, HorseOddModel horseOddModel) { if (horseOddModel != null && ModelState.IsValid) { horseOddModel.HorseName = SessionService.Horse.Where(w => w.Id == horseOddModel.HorseId).FirstOrDefault().Name; HorseOdd horseOdd = Mapper.Map <HorseOddModel, HorseOdd>(horseOddModel); SessionService.DbContainer.Resolve <HorseODDDataManager>().Update(horseOdd); } return(Json(new[] { horseOddModel }.ToDataSourceResult(request, ModelState))); }
public ActionResult CreateH([DataSourceRequest] DataSourceRequest request, HorseOddModel horseOddModel) { if (horseOddModel != null && ModelState.IsValid) { HorseOdd newEntity = Mapper.Map <HorseOddModel, HorseOdd>(horseOddModel); newEntity.CurrentTime = DateTime.Now; newEntity.RaceId = SessionService.CurrentRaceId; SessionService.DbContainer.Resolve <HorseODDDataManager>().Insert(newEntity); horseOddModel.HorseName = SessionService.Horse.Where(w => w.Id == horseOddModel.HorseId).FirstOrDefault().Name; } return(Json(new[] { horseOddModel }.ToDataSourceResult(request, ModelState))); }