arreglado lo de que se parseaban grupos extra
This commit is contained in:
@@ -269,6 +269,7 @@ public class AdminController: ControllerBase
|
|||||||
BadRequest(new { message = "Fallo al guardar los datos"});
|
BadRequest(new { message = "Fallo al guardar los datos"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record GrupoI_D(int Id, string Descripcion);
|
||||||
[HttpGet("api/admin/clientes/grupo")]
|
[HttpGet("api/admin/clientes/grupo")]
|
||||||
public IActionResult GetGruposByCliente([FromHeader(Name ="Auth")]string Auth, [FromQuery]long Dni){
|
public IActionResult GetGruposByCliente([FromHeader(Name ="Auth")]string Auth, [FromQuery]long Dni){
|
||||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
@@ -277,9 +278,10 @@ public class AdminController: ControllerBase
|
|||||||
|
|
||||||
if (Dni <= 0) return BadRequest(new {message = "No puede tener un dni con numero negativo o cero"});
|
if (Dni <= 0) return BadRequest(new {message = "No puede tener un dni con numero negativo o cero"});
|
||||||
|
|
||||||
IEnumerable<GrupoAdmin> list = RepositorioGrupos.Singleton.ObtenerGruposPorDni(Dni);
|
IEnumerable<GrupoI_D> list = RepositorioGrupos.Singleton.ObtenerGruposPorDni(Dni).Select(x=> new GrupoI_D(x.Id,x.Nombre));
|
||||||
return Ok(list);
|
return Ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPatch("api/admin/cliente/addGrupo")]
|
[HttpPatch("api/admin/cliente/addGrupo")]
|
||||||
public IActionResult AddGrupoACliente([FromHeader(Name = "Auth")]string Auth, [FromBody]EmailGrupo data){
|
public IActionResult AddGrupoACliente([FromHeader(Name = "Auth")]string Auth, [FromBody]EmailGrupo data){
|
||||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
@@ -418,4 +420,4 @@ public class AdminController: ControllerBase
|
|||||||
if (d.Domicilio=="")ret+="Campo Domicilio vacio\n";
|
if (d.Domicilio=="")ret+="Campo Domicilio vacio\n";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,15 +87,10 @@ public class RepositorioGrupos : RepositorioBase<RepositorioGrupos>
|
|||||||
return permisos.AsQueryable();
|
return permisos.AsQueryable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQueryable<GrupoAdmin> ObtenerGruposPorDni(long Dni)
|
public List<Grupo> ObtenerGruposPorDni(long Dni)
|
||||||
{
|
{
|
||||||
var con = Context;
|
var con = Context;
|
||||||
var grupos = con.Clientes.Where(x => x.Dni == Dni).SelectMany(x => x.Idgrupos)
|
var grupos = con.Clientes.Where(x => x.Dni == Dni).SelectMany(x => x.Idgrupos).ToList();
|
||||||
.Select(x => new GrupoAdmin
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
Descripcion = x.Nombre,
|
|
||||||
});
|
|
||||||
return grupos;
|
return grupos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user