private static object MapToGridModel(aloSorteos o) { return new { o.Id, o.detalle, o.fecha, o.fechaPago, o.estadia_desde, o.estadia_hasta, o.inscripcion_desde, o.inscripcion_hasta, tipo = o.aloTipos != null ? o.aloTipos.nombre : "", //.tipo_Id, }; }
public ActionResult Create(aloSorteoInput input) { if (!ModelState.IsValid) return PartialView(input); var entity = new aloSorteos { detalle = input.detalle, fecha = input.fecha, fechaPago = input.fechaPago, estadia_desde = input.estadia_desde, estadia_hasta = input.estadia_hasta, inscripcion_desde = input.inscripcion_desde, inscripcion_hasta = input.inscripcion_hasta, tipo_Id = input.tipo, }; UnitOfWork.AloSorteoRepository.Insert(entity); UnitOfWork.Save(); return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow }