Files
AlquilaFacil/Modelo/RepositorioLogs.cs

29 lines
861 B
C#

using System.Linq;
using Entidades;
using Microsoft.EntityFrameworkCore;
namespace Modelo;
public class RepositorioLogs: RepositorioBase<RepositorioLogs> {
public int ObtenerCantidadPaginas() {
var con = Context;
float a = con.Logs.Count()/10f;
int b = (int)a;
if (b != a){
b++;
}
return b;
}
public IOrderedEnumerable<LogDetalle> ObtenerDetallesLogs(DateTime fecha, long idusuario) {
var con = Context;
var d = con.Logs.Include(x=>x.LogDetalles)
.FirstOrDefault(x => x.Fecha == fecha && x.Dniusuario == idusuario);
return d.LogDetalles.OrderBy(x=>x.Id);
}
public IQueryable<Log>? ObtenerLogsPaginado(int pag) {
var con = Context;
var l = con.Logs.OrderByDescending(x=>x.Fecha).Skip(10*pag).Take(10);
return l;
}
}