Пример #1
0
 public LogModel GetLogByID(int id)
 {
     using (var suspect = new SuspictionModel())
     {
         return(suspect.Logs.First(x => x.logId == id));
     }
 }
Пример #2
0
 public IEnumerable <LogModel> GetAllLogs()
 {
     using (var suspect = new SuspictionModel())
     {
         return(suspect.Logs.ToList());
     }
 }
Пример #3
0
        /// <summary>
        /// Seeds data into the DB
        /// </summary>
        protected override void Seed(SuspictionModel context)
        {
            //Console.WriteLine(" ### Seeding ###");

            // letting the base method do anything it needs to get done
            //base.Seed(context);

            // Save the changes you made, when adding the data above
            //context.SaveChanges();
        }
Пример #4
0
 public bool DeleteLog(int id)
 {
     using (var suspect = new SuspictionModel())
     {
         suspect.Logs.Remove(suspect.Logs.First(x => x.logId == id));
         suspect.SaveChanges();
         var res = triggerPusher();
     }
     return(false);
 }
Пример #5
0
 public String[] getChartInfo()
 {
     String[] data = new String[3];
     using (var suspect = new SuspictionModel())
     {
         data[0] = suspect.Logs.Where(x => x.type == "Insider").ToList().Count().ToString();
         data[1] = suspect.Logs.Where(x => x.type == "Outsider").ToList().Count().ToString();
         data[2] = suspect.Logs.Where(x => x.type == "Not Sure").ToList().Count().ToString();
     }
     return(data);
 }
Пример #6
0
        public bool AddLog(LogModel logToSave)
        {
            LogModel log = logToSave;

            using (var suspect = new SuspictionModel())
            {
                suspect.Logs.Add(log);
                suspect.SaveChanges();
                var res = triggerPusher();
            }
            return(false);
        }
Пример #7
0
        public bool UpdateLog(LogModel log)
        {
            LogModel logToSave = log;

            using (var suspect = new SuspictionModel())
            {
                LogModel logToUpdate = suspect.Logs.First(x => x.logId == logToSave.logId);
                logToUpdate.header    = logToSave.header;
                logToUpdate.phone     = logToSave.phone;
                logToUpdate.useremail = logToSave.useremail;
                logToUpdate.username  = logToSave.username;
                logToUpdate.type      = logToSave.type;
                suspect.SaveChanges();
                var res = triggerPusher();
            }
            return(false);
        }