Example #1
0
 public async Task <ActionResult <BaseResponse> > InsertaActualizaUbicacion([FromBody] UbicacionesBodega ubicaciones)
 {
     try
     {
         return(await _bodegas.InsertaActualizaUbicacionBodega(ubicaciones));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        public async Task <BaseResponse> InsertaActualizaUbicacionBodega(UbicacionesBodega ubicacion)
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                BaseResponse request = new BaseResponse();
                request.resultado = new List <object>();
                try
                {
                    using (SqlCommand cmd = new SqlCommand("SP_INSERTA_ACTUALIZA_UBICACION_BODEGA", sql))
                    {
                        cmd.Parameters.Add(new SqlParameter("@CODIGO_BOD", ubicacion.codigoBod));
                        cmd.Parameters.Add(new SqlParameter("@ESTADO_BUI", ubicacion.estado));
                        cmd.Parameters.Add(new SqlParameter("@CODIGO_UBI", ubicacion.codigoBui));

                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        request.status  = "correcto";
                        request.mensaje = "Consulta Correcta";
                        Respuesta respuesta = new Respuesta();
                        request.codigo = "201";
                        await sql.OpenAsync();

                        using (var reader = await cmd.ExecuteReaderAsync())
                        {
                            while (await reader.ReadAsync())
                            {
                                respuesta = Utilidades.MapearRespuesta(reader);
                                request.resultado.Add(respuesta);
                            }
                        }
                        return(request);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }