avance: estado pre implementacion de notificaciones

This commit is contained in:
2025-01-06 21:22:58 -03:00
parent 5b3e65db2f
commit ed0d83dafe
14 changed files with 294 additions and 8 deletions
+26
View File
@@ -0,0 +1,26 @@
using System.Security.Cryptography;
using System.Text;
using Entidades.Dto;
using Entidades;
using Microsoft.EntityFrameworkCore;
namespace Modelo;
public class RepositorioNotificaciones : RepositorioBase<RepositorioNotificaciones> {
public bool MarcarComoLeido(long dni, DateTime? fecha) {
if (fecha == null) return false;
var con = Context;
Notificacione? noti = con.Notificaciones.FirstOrDefault(x=> x.Dnicliente == dni && x.Fecha == fecha);
if (noti == null) return false;
noti.Leido = true;
return Guardar(con);
}
public bool AltaNotificacion(Notificacione n) {
var con = Context;
con.Notificaciones.Add(n);
return Guardar(con);
}
}
+8
View File
@@ -177,4 +177,12 @@ public class RepositorioUsuarios: RepositorioBase<RepositorioUsuarios> {
Cliente? cli = con.Clientes.FirstOrDefault(x=>x.Dni == dni);
return cli;
}
public Cliente? ObtenerClientePorToken(string token) {
var con = Context;
Cliente? cli = con.Clientes.Include(x=>x.NotificacioneDniclienteNavigations).FirstOrDefault(x=>x.Token == token);
if (cli == null|| cli.Dni == 0) return null;
return cli;
}
}