Esempio n. 1
0
        public ActionResult Edit(int id)
        {
            var entity = UnitOfWork.AppChofereRepository.GetById(id);

            var input = new appChofereInput
            {
                Id = entity.Id,
                nombre = entity.nombre,
                foto = entity.foto,
                lic = entity.lic
            };

            return PartialView("Create", input);
        }
Esempio n. 2
0
        public ActionResult Create(appChofereInput input)
        {
            if (!ModelState.IsValid) return PartialView(input);

            var entity = new appChoferes
            {
                nombre = input.nombre,
                foto = input.foto,
                lic = input.lic,
                usuario_Id=input.idUsuario
            };

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

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

            entity.nombre = input.nombre;
            entity.foto = input.foto;
            entity.lic = input.lic;

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

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