public IActionResult Add()
        {
            var viewModel = new TimbradosAddViewModel()
            {
                Cajas = _cajas.GetAll().Select(x => new AdditionalData()
                {
                    Value = x.Id, Text = x.Nombre, AdditionalInt = x.SucursalId
                }).ToList(),
                Sucursales = _sucursales.GetAll().Select(x => new DropDownViewModel <int>()
                {
                    Value = x.Id, Text = $"{x.Nombre} - Codigo Establecimiento: {x.CodigoEstablecimiento}"
                }).ToList()
            };

            return(View(viewModel));
        }
        public SystemValidationModel Save(TimbradosAddViewModel viewModel)
        {
            var validation = VerifyTimbrado(viewModel.FechaInicio, viewModel.FechaFin, viewModel.NroInicio, viewModel.NroFin, viewModel.NroTimbrado, viewModel.SucursalId, viewModel.CajaId);

            if (validation != null)
            {
                return(validation);
            }

            var timbrado = Mapper.Map <Timbrado>(viewModel);

            _context.Entry(timbrado).State = EntityState.Added;
            var success = _context.SaveChanges() > 0;

            validation = new SystemValidationModel()
            {
                Id      = timbrado.Id,
                Message = success ? "Se ha guardado correctamente el timbrado" : "No se pudo guardar el timbrado",
                Success = success
            };
            return(validation);
        }