public async Task <ActionResult <BaseResponse> > ActualizarPaginasPerfil([FromBody] PaginaPerfil paginaPerfil) { BaseResponse response = new BaseResponse(); try { return(await _perfiles.GuardarPaginaPerfil(paginaPerfil)); } catch (Exception er) { response.codigo = "500"; response.status = "error"; response.mensaje = er.Message; return(response); } }
public async Task <BaseResponse> GuardarPaginaPerfil(PaginaPerfil pagina) { BaseResponse response = new BaseResponse(); response.resultado = new List <object>(); try { using (SqlConnection sql = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("SP_INSERTA_ACTUALIZA_PAGINA", sql)) { cmd.Parameters.Add(new SqlParameter("@CODIGO_PUS", pagina.codigoPerfil)); cmd.Parameters.Add(new SqlParameter("@ESTAACTIVO_MPE", pagina.estadoMpe)); cmd.Parameters.Add(new SqlParameter("@CODIGO_PAG", pagina.codigoPagina)); cmd.CommandType = System.Data.CommandType.StoredProcedure; Respuesta respuesta = new Respuesta(); response.status = "correcto"; response.mensaje = "Consulta Correcta"; Perfiles _perfiles = new Perfiles(); response.codigo = "201"; await sql.OpenAsync(); using (var reader = await cmd.ExecuteReaderAsync()) { while (await reader.ReadAsync()) { response.resultado.Add(Utilidades.MapearRespuesta(reader)); } } return(response); } } } catch (Exception er) { response.codigo = "500"; response.mensaje = er.Message; response.status = "error"; return(response); } }
public List <PaginaPerfil> Search(PaginaPerfil obj) { List <PaginaPerfil> lista = new List <PaginaPerfil>(); using (SqlConnection oConnection = new SqlConnection(Conexao.DefaultConnection)) { oConnection.Open(); using (SqlCommand oCommand = oConnection.CreateCommand()) { oCommand.CommandText = Conexao.Owner + "usp_Pagina_Perfil_Search"; oCommand.CommandType = CommandType.StoredProcedure; #region --- Parâmetros --- oCommand.Parameters.Clear(); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@pgp_Id", Direction = ParameterDirection.Input, IsNullable = true, SqlValue = obj.PaginaPerfilId ?? (object)DBNull.Value }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@mnu_Id", Direction = ParameterDirection.Input, IsNullable = true, SqlValue = obj.MenuId ?? (object)DBNull.Value }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@pag_Id", Direction = ParameterDirection.Input, IsNullable = true, SqlValue = obj.PaginaId ?? (object)DBNull.Value }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@per_Id", Direction = ParameterDirection.Input, IsNullable = true, SqlValue = obj.PerfilId ?? (object)DBNull.Value }); #endregion try { SqlDataReader oDr = oCommand.ExecuteReader(); while (oDr.Read()) { PaginaPerfil item = new PaginaPerfil { PaginaPerfilId = Convert.ToInt64(oDr["pgp_Id"]), MenuId = Convert.ToInt64(oDr["mnu_Id"]), PaginaId = Convert.ToInt64(oDr["pag_Id"]), PerfilId = Convert.ToInt64(oDr["per_Id"]), }; lista.Add(item); } } catch (SqlException ex) when(ex.Server == ".\\SQLEXPRESS") { Console.WriteLine("SQL Provider Error: " + ex.Message); } catch (Exception ex) when(ex.InnerException.ToString() == "Parameter Error") { Console.WriteLine("SQL Provider Error: " + ex.Message); } } oConnection.Close(); } return(lista); }
public PaginaPerfil Find(PaginaPerfil obj) { throw new NotImplementedException(); }
public long?Insert(PaginaPerfil obj) { throw new NotImplementedException(); }
public List <PaginaPerfilDisponivel> ListarDisponivel(PaginaPerfil obj) { throw new NotImplementedException(); }
public bool Delete(PaginaPerfil obj) { throw new NotImplementedException(); }