示例#1
0
        public ActionResult Create(appParadaInput input)
        {
            if (!ModelState.IsValid) return PartialView(input);

            var entity = new appParadas
            {
                nombre = input.nombre,
                hora = input.hora,
                min = input.hora == 999 ? 0 : input.min,
                estacion_Id = input.estacion_Id,
                ruta_Id = input.ruta_Id,
                duracion = input.hora == 999 ? 0 : input.duracion,
                esRetorno = input.esRetorno,
                currHora = input.hora,
                currMin = input.hora == 999 ? 0 : input.min,
                estDuracion = input.hora == 999 ? 0 : input.duracion,
            };

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

            return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow
        }
示例#2
0
        public ActionResult Edit(appParadaInput input)
        {
            if (!ModelState.IsValid) return PartialView("Create", input);
            var entity = UnitOfWork.AppParadaRepository.GetById(input.Id);

            entity.nombre = input.nombre;
            entity.hora = input.hora;
            entity.min = input.hora == 999 ? 0 : input.min;
            entity.estacion_Id = input.estacion_Id;
            entity.ruta_Id = input.ruta_Id;
            entity.duracion = input.hora == 999 ? 0 : input.duracion;
            entity.esRetorno = input.esRetorno;
            entity.currHora = input.hora;
            entity.currMin = input.hora == 999 ? 0 : input.min;
            entity.estDuracion = input.hora == 999 ? 0 : input.duracion;

            UnitOfWork.AppParadaRepository.Update(entity);
            UnitOfWork.Save();

            // returning the key to call grid.api.update
            return Json(new { input.Id });
        }
示例#3
0
        public ActionResult Edit(int id)
        {
            var entity = UnitOfWork.AppParadaRepository.GetById(id);

            var input = new appParadaInput
            {
                Id = entity.Id,
                nombre = entity.nombre,
                hora = entity.hora,
                min = entity.min,
                estacion_Id = entity.appEstaciones.Id,
                duracion = entity.duracion,
                esRetorno = entity.esRetorno,
            };

            return PartialView("Create", input);
        }