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

            _context.TiposUbicacion.Add(tipoUbicacion);
            _context.SaveChanges();
        }
Example #2
0
        public void UpdateTipoUbicacion(TipoUbicacion tipoUbicacion)
        {
            if (ExistsTipoUbicacion(tipoUbicacion.EmpresaId, tipoUbicacion.Codigo, tipoUbicacion.TipoUbicacionId))
            {
                throw new ApplicationException("Ya existe un tipo de ubicacion con el código indicado");
            }

            _context.TiposUbicacion.Attach(tipoUbicacion);
            _context.Entry(tipoUbicacion).State = EntityState.Modified;
            _context.SaveChanges();
        }