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
        }
        public ActionResult Edit(aloExcepcioneInput input)
        {
            if (!ModelState.IsValid) return PartialView("Create", input);
            var entity = UnitOfWork.AloExcepcioneRepository.GetById(input.Id);

            entity.nombre = input.nombre;
            entity.descripcion = input.descripcion;
            entity.desde = input.desde;
            entity.hasta = input.hasta;
            entity.porcentaje = input.porcentaje;
            entity.aloTipos =UnitOfWork.AloTipoRepository.GetById( input.tipo);
            entity.tipoExcep = input.tipoExcep;

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

            // returning the key to call grid.api.update
            return Json(new { input.Id });
        }
        public ActionResult Edit(int id, bool hide_tipo = false)
        {
            var entity = UnitOfWork.AloExcepcioneRepository.GetById(id);

            var input = new aloExcepcioneInput
            {
                Id = entity.Id,
                nombre = entity.nombre,
                descripcion = entity.descripcion,
                desde = entity.desde,
                hasta = entity.hasta,
                porcentaje = entity.porcentaje,
                tipo = entity.aloTipos.Id,
                hide_tipo = hide_tipo,
                tipoExcep = entity.tipoExcep,
            };

            return PartialView("Create", input);
        }