diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TipoPuestoTrabajo.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TipoPuestoTrabajo.razor new file mode 100644 index 0000000..aedabfe --- /dev/null +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TipoPuestoTrabajo.razor @@ -0,0 +1,234 @@ +@page "/TipoPuestoTrabajo" +@page "/TipoPuestoTrabajo/{cl}" +@using BlazorBootstrap +@using GestionPersonalWeb.Components.Pages.FicherosMaestros.TipoPuestoTrabajoComponents +@using Newtonsoft.Json +@using GestionPersonalWeb.Components.Layout +@using Microsoft.AspNetCore.WebUtilities +@using GestionPersonalWeb.Components.Pages.InfoPersComponents +@using GestionPersonalWeb.Models +@using System.Linq.Expressions +@using Serialize.Linq.Serializers +@using System.Net.Http.Headers +@using bdAntifraude.clases +@using bdAntifraude.db +@using System.Reflection +@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage +@inject IJSRuntime JSRuntime +@inject IJSRuntime JS +@rendermode InteractiveServer +@inject NavigationManager NavigationManager +@inject IHttpClientFactory HttpClientFactory +@inject IHttpContextAccessor HttpContextAccessor +@inject UserState UserState +@inject ProtectedSessionStorage ProtectedSessionStore +@inject NavigationManager Navigation + + +@*
+
Tipo puesto de trabajo: @puestoTrabajo.DESCRIPCION
+
*@ + +
+
+
+
+
+
+
+
+ + +
+
+ + + + @if (lGrupos != null) + { + @foreach (var enumera in lGrupos) + { + + } + } + + +
+
+ + +
+
+
+
+
+
+ + + + @if (lTipoPersonal != null) + { + @foreach (var enumera in lTipoPersonal) + { + + } + } + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+ @if (puestoTrabajo.IDTIPOPUESTO != 0) + { + + } +
+
+
+ + + +@code { + [Parameter] + public string? cl { get; set; } = ""; + private static bdAntifraude.db.TIPOSPUESTOSTRABAJO puestoTrabajo = new TIPOSPUESTOSTRABAJO(); + private List lGrupos = new List(); + private List lTipoPersonal = new List(); + private EditContext editContext = new EditContext(puestoTrabajo); + private Tabs tabsPuesTrab { get; set; } = new Tabs(); + + private HttpClient cliente = new HttpClient(); + private ValidationMessageStore? messageStore; + private string errorMessage = ""; + List mensajes = new List(); + public bool mostrar { get; set; } = true; + public bool mostrarBtn { get; set; } = false; + + + + protected override async Task OnInitializedAsync() + { + try + { + var url = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); + cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + + if (QueryHelpers.ParseQuery(url.Query).TryGetValue("cl", out var clValue)) + { + cl = clValue; + } + + if (string.IsNullOrEmpty(cl)) + { + puestoTrabajo = new TIPOSPUESTOSTRABAJO(); + mostrarBtn = true; + } + else + { + // ListaSexos = await Utilidades.ObtenerObjeto>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/SEXO"); + string idDesencriptado = Utilidades.Desencriptar(cl); + int id = int.Parse(idDesencriptado); + + var response = await cliente.GetAsync($"/api/TIPOSPUESTOSTRABAJO/{id}"); + if (!response.IsSuccessStatusCode) + { + throw new Exception($"Error al obtener los datos del Tipo de Trabajo. Código: {response.StatusCode}"); + } + + var resultContent = await response.Content.ReadAsStringAsync(); + puestoTrabajo = JsonConvert.DeserializeObject(resultContent) ?? throw new Exception("Error al deserializar los datos de la persona."); + } + editContext = new EditContext(puestoTrabajo); + messageStore = new ValidationMessageStore(editContext); + + mostrar = false; + await CargarSelects(); + } + catch (Exception ex) + { + errorMessage = ex.Message; + Console.WriteLine($"Error durante la inicialización: {ex.Message}"); + mostrar = false; + } + finally + { + mostrar = false; + } + } + + private async Task GuardarPuestoTrabajo() + { + cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + if (!editContext.GetValidationMessages().Any()) + { + if (puestoTrabajo.IDTIPOPUESTO == 0)//Nuevo + { + var response = await Utilidades.NuevoObjeto(cliente, "/api/TIPOSPUESTOSTRABAJO", puestoTrabajo,mensajes); + if (response != null) + { + puestoTrabajo = response; + } + else + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Success, + Message = $"Guardado Correctamente.", + }); + } + await InvokeAsync(StateHasChanged); + } + else//Guardar + { + var response = await Utilidades.ActualizarObjeto(cliente, "/api/TIPOSPUESTOSTRABAJO/" + puestoTrabajo.IDTIPOPUESTO, puestoTrabajo,mensajes); + } + } + else + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Danger, + Message = Utilidades.ListaErroresHtml(editContext.GetValidationMessages()), + }); + + } + } + + private async Task CargarSelects() + { + try + { + + lTipoPersonal = await Utilidades.ObtenerObjeto>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/TIPPER"); + lGrupos = await Utilidades.ObtenerObjeto>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/GRUPOFUNCIONARIO"); + StateHasChanged(); + } + catch (Exception ex) + { + errorMessage = ex.Message; + Console.WriteLine($"Error durante la inicialización: {ex.Message}"); + mostrar = false; + } + + } +} diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TipoPuestoTrabajoComponents/ConceptosTipoTrabajoGrid.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TipoPuestoTrabajoComponents/ConceptosTipoTrabajoGrid.razor new file mode 100644 index 0000000..ba88d03 --- /dev/null +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TipoPuestoTrabajoComponents/ConceptosTipoTrabajoGrid.razor @@ -0,0 +1,297 @@ +@using System.Net.Http.Headers +@using System.Linq.Expressions +@using Newtonsoft.Json +@using System.Text +@using Serialize.Linq.Serializers +@using GestionPersonalWeb.Models +@using BlazorBootstrap +@using bdAntifraude.db +@using Microsoft.AspNetCore.Components +@rendermode InteractiveServer +@inject IJSRuntime JS +@inject NavigationManager NavigationManager +@inject IHttpClientFactory HttpClientFactory +@inject IHttpContextAccessor HttpContextAccessor +@inject UserState UserState + + + +
+
+ +
+
+ Conceptos Tipos Puestos de Trabajo +
+
+
+
+ + + + + + + + @lConceptosGenerales.First(x => x.IDCONCEPTOSGENERALES == context.IDCONCEPTOGENERAL).DESCRIPCION + + + @context.DESCRIPCION + + + @context.IMPORTE + + + @context.CONCEPTOAPLPRES + + + @context.APLICACIONPRESUPUESTARIA + + + @if (context.COTIZASEGURIDADSOCIAL) + { + + } + + + @if (context.COTIZAIRPF) + { + + } + + + @if (context.RETRIBUCIONES) + { + + } + + + @if (context.DEDUCCIONES) + { + + } + + + @if (context.EXTRA) + { + + } + + + + +
+
+ + + + + +
+
+ + + + @if (lConceptosGenerales != null) + { + @foreach (var concepto in lConceptosGenerales) + { + + } + } + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
+ + + + +
+
+@code { + [Parameter] + public TIPOSPUESTOSTRABAJO PuestoTrabajo { get; set; } = new TIPOSPUESTOSTRABAJO(); + private HttpClient cliente = new HttpClient(); + private List itmList = new List(); + private List lConceptosGenerales = new List(); + + private string tituloPopup = ""; + private Modal popupGestionDatos = default; + private bool EsItemNuevo = false; + private CONCEPTOSTIPOSPUESTOSTRABAJO ItemEnEdicion { get; set; } = new CONCEPTOSTIPOSPUESTOSTRABAJO(); + + private EditContext? editContext; + List listnom = new List(); + + List mensajes = new List(); + + protected override async Task OnInitializedAsync() + { + try + { + listnom= PuestoTrabajo.CONCEPTOSTIPOSPUESTOSTRABAJO.ToList(); + foreach (CONCEPTOSTIPOSPUESTOSTRABAJO i in listnom) { itmList.Add(i); } + editContext=new EditContext(listnom); + + cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + lConceptosGenerales = await Utilidades.ObtenerObjeto>(cliente, "/api/CONCEPTOSGENERALES/"); + } + catch (Exception e) + { + Console.WriteLine($"Error al obtener los datos: {e.Message}"); + } + } + + private async Task abrirPopupModificacion( CONCEPTOSTIPOSPUESTOSTRABAJO objeto, bool esNuevo) + { + ItemEnEdicion = Utilidades.ClonarObjeto(objeto); + EsItemNuevo = esNuevo; + if (!EsItemNuevo) + { + tituloPopup = "Modificando Concepto Tipo Trabajo"; + } + else + { + tituloPopup = "Nuevo Concepto Tipo Trabajo"; + } + + await popupGestionDatos.ShowAsync(); + } + private async Task cerrarPopupModificacion() + { + await popupGestionDatos.HideAsync(); + } + + // GUARDAR + private async Task GuardarCambiosPopup() + { + try + { + ValidarDatos(); + + if (!editContext!.GetValidationMessages().Any()) + { + string accion = EsItemNuevo ? "create" : "update"; + await GestionarDatos(accion); + } + else + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Warning, + Message = $"Debe rellenar los campos obligatorios.", + }); + } + + } + catch (Exception) + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Danger, + Message = $"Error al guardar.", + }); + } + + } + private async Task GestionarDatos(string accion) + { + var copia = new List(itmList); + cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + + switch (accion) + { + case "update": + int indice = copia.FindIndex(x => x.IDCONCEPTOSTIPOSPUESTOTRABAJO == ItemEnEdicion.IDCONCEPTOSTIPOSPUESTOTRABAJO); + if (indice > -1) + { + copia[indice] = ItemEnEdicion; + } + var response = await Utilidades.ActualizarObjeto(cliente, "/api/CONCEPTOSTIPOSPUESTOSTRABAJO/" + ItemEnEdicion.IDCONCEPTOSTIPOSPUESTOTRABAJO, ItemEnEdicion, mensajes); + + break; + case "create": + ItemEnEdicion.IDTIPOPUESTOSTRABAJO = PuestoTrabajo.IDTIPOPUESTO; + copia.Add(ItemEnEdicion); + var responsec = await Utilidades.NuevoObjeto(cliente, "/api/CONCEPTOSTIPOSPUESTOSTRABAJO/", ItemEnEdicion,mensajes); + break; + case "delete": + + break; + } + cerrarPopupModificacion(); + itmList = copia.ToList(); + await InvokeAsync(StateHasChanged); + } + private void ValidarDatos() + { + + } + private void MostrarErroresPopup() + { + // messageStore?.Clear(); + // foreach (var field in new[] { nameof(descripcionItem) }) + // { + // ValidarYActualizar(new ChangeEventArgs { Value = typeof(enumeraciones).GetProperty(field)?.GetValue(itemSeleccionado) }, field); + // } + } + + +} diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TiposPuestoTrabajo.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TiposPuestoTrabajo.razor index 5c8e896..f24f357 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TiposPuestoTrabajo.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/FicherosMaestros/TiposPuestoTrabajo.razor @@ -17,8 +17,13 @@ @inject UserState UserState
-
-
Tipos puesto de trabajo
+
+ Nuevo +
+
+ Conceptos Tipos Puestos de Trabajo +
+
@if (lPuestos == null) @@ -54,6 +59,9 @@ Responsive="true" PaginationItemsTextFormat="{0} - {1} de {2} elementos"> +@* + @context.IDTIPOPUESTO + *@ @context.DESCRIPCION @@ -186,7 +194,7 @@ // } private string HashRed(string id) { - string link = "/infoPers?cl=" + tsUtilidades.crypt.FEncS( + string link = "/TipoPuestoTrabajo?cl=" + tsUtilidades.crypt.FEncS( id, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor index 3e893ca..4ec0d80 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor @@ -383,7 +383,7 @@ if (persona.IDFICHEROFOTO != null) { var responsef = await Utilidades.ActualizarObjeto(cliente, "/api/FICHEROS/" + fi.IDFICHERO, fi); - persona.IDFICHEROFOTO = responsef.IDFICHERO; + //persona.IDFICHEROFOTO = responsef.IDFICHERO; } else diff --git a/Antifraude.Net/GestionPersonalWeb/Models/Utilidades.cs b/Antifraude.Net/GestionPersonalWeb/Models/Utilidades.cs index 459cfa9..575086b 100644 --- a/Antifraude.Net/GestionPersonalWeb/Models/Utilidades.cs +++ b/Antifraude.Net/GestionPersonalWeb/Models/Utilidades.cs @@ -1,15 +1,18 @@ -using System.Net.Http.Headers; -using Newtonsoft.Json; -using System.Linq.Expressions; -using Serialize.Linq.Serializers; -using System.Text; -using System.Globalization; -using tsDocumentos; -using Microsoft.JSInterop; +using BlazorBootstrap; using ClosedXML.Excel; //using System.Drawing; using ClosedXML.Excel; +using DevExpress.DataAccess.Native.Web; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.JSInterop; using MigraDocCore.DocumentObjectModel; +using Newtonsoft.Json; +using Serialize.Linq.Serializers; +using System.Globalization; +using System.Linq.Expressions; +using System.Net.Http.Headers; +using System.Text; +using tsDocumentos; namespace GestionPersonalWeb.Models @@ -111,7 +114,7 @@ namespace GestionPersonalWeb.Models return default(T); } } - public static async Task NuevoObjeto(HttpClient cliente, String uri, T objeto) + public static async Task NuevoObjeto(HttpClient cliente, String uri, T objeto, List mensajes = null) { try { @@ -122,22 +125,77 @@ namespace GestionPersonalWeb.Models if (response.IsSuccessStatusCode) { + if (mensajes != null) + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Success, + Message = $"Guardado Correctamente.", + }); + } var resultContent = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(resultContent); } else { + if (mensajes != null) + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Danger, + Message = $"{response}", + AutoHide = false + }); + } return default(T); } + } catch (Exception ex) { var mess = ex.ToString(); + if (mensajes != null) + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Success, + Message = $"{mess}", + AutoHide = false + }); + } + return default(T); } } - public static async Task ActualizarObjeto(HttpClient cliente, String uri, T objeto) + //public static async Task ActualizarObjeto(HttpClient cliente, String uri, T objeto) + //{ + // try + // { + // // Limpiar propiedades de navegación + // VaciarPropiedadesDeNavegacion(objeto); + + // // Realizar la solicitud PUT + // var response = await cliente.PutAsJsonAsync(uri, objeto); + + // if (response.IsSuccessStatusCode) + // { + // var resultContent = await response.Content.ReadAsStringAsync(); + // return JsonConvert.DeserializeObject(resultContent); + // } + // else + // { + // Console.WriteLine($"Error al actualizar: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"); + // return default(T); + // } + // } + // catch (Exception ex) + // { + // var mess = ex.ToString(); + // return default(T); + // } + //} + public static async Task ActualizarObjeto(HttpClient cliente, String uri, T objeto, List mensajes = null) { try { @@ -149,19 +207,40 @@ namespace GestionPersonalWeb.Models if (response.IsSuccessStatusCode) { - var resultContent = await response.Content.ReadAsStringAsync(); - return JsonConvert.DeserializeObject(resultContent); + //var resultContent = await response.Content.ReadAsStringAsync(); + //return JsonConvert.DeserializeObject(resultContent); + + if (mensajes != null) + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Success, + Message = $"Guardado Correctamente.", + }); + } + return "Ok"; } else { - Console.WriteLine($"Error al actualizar: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"); - return default(T); + //Console.WriteLine($"Error al actualizar: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"); + //return default(T); + + if (mensajes != null) + { + mensajes.Add(new ToastMessage + { + Type = ToastType.Danger, + Message = $"{response}", + AutoHide = false + }); + } + return $"Error al actualizar: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"; } } catch (Exception ex) { var mess = ex.ToString(); - return default(T); + return mess; } } public static async Task ExportarExcelEnBrowser(IJSRuntime js, IEnumerable datos, byte[] logoBytes, XLColor headerColor, string nombreFichero) @@ -201,6 +280,35 @@ namespace GestionPersonalWeb.Models } } + public static string Encriptar(object valor) { + return tsUtilidades.crypt.FEncS(valor.ToString(), + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", + 875421649); + } + public static string Desencriptar(object valor) { + return tsUtilidades.crypt.FEncS(valor.ToString(), + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", + -875421649); + } + + public static string ListaErroresHtml(IEnumerable lista) { + var html = ""; + html += "Revise los errores antes de guardar:"; + foreach (string m in lista) + { + html += "\n" + m + ". "; + } + return html; + } + + public static T ClonarObjeto(T objeto) + { + var json = System.Text.Json.JsonSerializer.Serialize(objeto); + return System.Text.Json.JsonSerializer.Deserialize(json); + } + } } diff --git a/Antifraude.Net/SwaggerAntifraude/Controllers/CONCEPTOSTIPOSPUESTOSTRABAJOController.cs b/Antifraude.Net/SwaggerAntifraude/Controllers/CONCEPTOSTIPOSPUESTOSTRABAJOController.cs new file mode 100644 index 0000000..f054ec2 --- /dev/null +++ b/Antifraude.Net/SwaggerAntifraude/Controllers/CONCEPTOSTIPOSPUESTOSTRABAJOController.cs @@ -0,0 +1,70 @@ +using bdAntifraude.db; +using bdAntifraude.dbcontext; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.EntityFrameworkCore; +using Serialize.Linq.Serializers; +using System.Linq.Expressions; +using SwaggerAntifraude.Controllers; + +namespace SwaggerAntifraude.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class CONCEPTOSTIPOSPUESTOSTRABAJOController : GenericoController + { + public CONCEPTOSTIPOSPUESTOSTRABAJOController() + : base() + { + } + + [HttpGet] + public override async Task GetAll() + { + try + { + using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false)) + { + var entities = await context.CONCEPTOSTIPOSPUESTOSTRABAJO + //.Include(x => x.IDTIPOPERSONANavigation) + .AsNoTracking() + .ToListAsync(); + return Ok(entities); + } + } + catch (Exception ex) + { + return StatusCode(500, $"Error interno del servidor: {ex.Message}"); + } + } + + [Authorize(Policy = "LecturaPolicy")] + [HttpGet("{id}")] + public override IActionResult GetById(int id) + { + try + { + using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false)) + { + //var dbSet = context.Set(); + var entities = context.CONCEPTOSTIPOSPUESTOSTRABAJO + .AsNoTracking() + .FirstOrDefault(v => v.IDCONCEPTOSTIPOSPUESTOTRABAJO == id); + + + + if (entities == null) + return NotFound(); + + return Ok(entities); + } + } + catch (Exception ex) + { + return StatusCode(500, $"Error interno del servidor: {ex.Message}"); + } + } + + + } +} diff --git a/Antifraude.Net/SwaggerAntifraude/Controllers/TIPOSPUESTOSTRABAJOController.cs b/Antifraude.Net/SwaggerAntifraude/Controllers/TIPOSPUESTOSTRABAJOController.cs index 4b64d16..a7ffa41 100644 --- a/Antifraude.Net/SwaggerAntifraude/Controllers/TIPOSPUESTOSTRABAJOController.cs +++ b/Antifraude.Net/SwaggerAntifraude/Controllers/TIPOSPUESTOSTRABAJOController.cs @@ -27,6 +27,7 @@ namespace SwaggerAntifraude.Controllers { var entities = await context.TIPOSPUESTOSTRABAJO .Include(x => x.IDTIPOPERSONANavigation) + .Include(x=> x.CONCEPTOSTIPOSPUESTOSTRABAJO).ThenInclude(x=> x.IDCONCEPTOGENERALNavigation) .AsNoTracking() .ToListAsync(); return Ok(entities); @@ -47,13 +48,12 @@ namespace SwaggerAntifraude.Controllers using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false)) { //var dbSet = context.Set(); - var entities = context.NOMINAS - .Include(x => x.IDTIPONavigation) - .Include(x => x.IDSITUACIONNOMINANavigation) - //.Include(x => x.NOMINATRABAJADORCABECERA) + var entities = context.TIPOSPUESTOSTRABAJO + .Include(x => x.IDTIPOPERSONANavigation) + .Include(x => x.CONCEPTOSTIPOSPUESTOSTRABAJO).ThenInclude(x => x.IDCONCEPTOGENERALNavigation) //.ThenInclude(pr => pr.IDPERSONANavigation) .AsNoTracking() - .FirstOrDefault(v => v.IDNOMINAS == id); + .FirstOrDefault(v => v.IDTIPOPUESTO == id);