Example #1
0
        public ActionResult Edit(int id)
        {
            var entity = UnitOfWork.AppBusRepository.GetById(id);

            var input = new appBusInput
            {
                Id = entity.Id,
                nombre = entity.nombre,
                descrip = entity.descrip,
                placa = entity.placa,
                pasajeros = entity.pasajeros
            };

            return PartialView("Create", input);
        }
Example #2
0
        public ActionResult Create(appBusInput input)
        {
            if (!ModelState.IsValid) return PartialView(input);

            var entity = new appBuses
            {
                nombre = input.nombre,
                descrip = input.descrip,
                placa = input.placa,
                pasajeros = input.pasajeros
            };

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

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

            entity.nombre = input.nombre;
            entity.descrip = input.descrip;
            entity.placa = input.placa;
            entity.pasajeros = input.pasajeros;

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

            // returning the key to call grid.api.update
            return Json(new { input.Id });
        }