Exemplo n.º 1
0
        public ActionResult Create(appRutaInput input)
        {
            if (!ModelState.IsValid) return PartialView("Create", input);
            var entity = new appRutas
            {
                nombre = input.nombre,
                descrip = input.descrip,
                dias = input.dias == null ? "" : string.Join("-", input.dias),
                activa = input.activa,
                currLat = input.currLat,
                currLon = input.currLon,
                currBus_Id = input.currBus_Id,
                currChofer_Id = input.currChofer_Id,
                //appBuses = UnitOfWork.AppBusRepository.GetById( input.currBus_Id),
                //appChoferes = UnitOfWork.AppChofereRepository.GetById(input.currChofer_Id),
                lastBoard = input.lastBoard,
            };

            UnitOfWork.AppRutaRepository.Insert(entity);
            UnitOfWork.Save();

            //return PartialView("Details", entity.Id);

            return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow
        }
Exemplo n.º 2
0
 private static object MapToGridModel(appRutas o)
 {
     return
         new
         {
             o.Id,
             o.nombre,
             o.descrip,
             o.dias,
             o.activa,
             o.currLat,
             o.currLon,
             currBus = o.appBuses != null ? o.appBuses.nombre : "",
             currChofer = o.appChoferes != null ? o.appChoferes.nombre : "",
             o.lastBoard,
         };
 }