private static object MapToGridModel(aloExcepciones o) { return new { o.Id, o.nombre, o.descripcion, o.desde, o.hasta, o.porcentaje, tipo = o.aloTipos != null ? o.aloTipos.nombre : "", //.tipo_Id, o.tipoExcep, }; }
public ActionResult Create(aloExcepcioneInput input) { if (!ModelState.IsValid) return PartialView(input); var entity = new aloExcepciones { nombre = input.nombre, descripcion = input.descripcion, desde = input.desde, hasta = input.hasta, porcentaje = input.porcentaje, aloTipos =UnitOfWork.AloTipoRepository.GetById( input.tipo), tipoExcep = input.tipoExcep, }; UnitOfWork.AloExcepcioneRepository.Insert(entity); UnitOfWork.Save(); return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow }