avance: estado pre implementacion de notificaciones
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user