using System;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using AyaNova.Models;
using AyaNova.Util;
namespace AyaNova.Biz
{
internal static class EventLogProcessor
{
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("EventLogProcessor");
///
/// Add an entry to the log
///
///
///
///
internal static void AddEntry(Event newEvent, AyContext ct)
{
ct.Event.Add(newEvent);
ct.SaveChanges();
}
///
/// Handle delete
/// remove all prior entries for object, add one deleted entry
///
///
///
///
///
///
internal static void DeleteObject(long userId, AyaType ayType, long ayId, string textra, AyContext ct)
{
ct.Database.ExecuteSqlCommand($"delete from aevent where aytype = {ayType} and ayid={ayId}");
ct.Event.Add(new Event(userId, ayId, ayType, AyaEvent.Deleted, textra));
ct.SaveChanges();
}
internal static Task GetLogForObject(long ayId, AyContext ct)
{
throw new NotImplementedException();
}
internal static Task GetLogForUser(long ayId, AyContext ct)
{
throw new NotImplementedException();
}
/////////////////////////////////////////////////////////////////////
}//eoc
}//eons