Example #1
0
        public void AddTipoContenedor(TipoContenedor tipoContenedor)
        {
            if (ExistsTipoContenedor(tipoContenedor.EmpresaId, tipoContenedor.Codigo))
            {
                throw new ApplicationException("Ya existe un tipo de ubicacion con el código indicado");
            }

            _context.TiposContenedor.Add(tipoContenedor);
            _context.SaveChanges();
        }
Example #2
0
        public void UpdateTipoContenedor(TipoContenedor tipoContenedor)
        {
            if (ExistsTipoContenedor(tipoContenedor.EmpresaId, tipoContenedor.Codigo, tipoContenedor.TipoContenedorId))
            {
                throw new ApplicationException("Ya existe un tipo de ubicacion con el código indicado");
            }

            _context.TiposContenedor.Attach(tipoContenedor);
            _context.Entry(tipoContenedor).State = EntityState.Modified;
            _context.SaveChanges();
        }