Пример #1
0
        public bool LogCreate(string model)
        {
            var newLog = new LogListItems()
            {
                WhatHappened = model
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Logs.Add(newLog);
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #2
0
 public IEnumerable <LogListItems> GetLogs()
 {
     using (var ctx = new ApplicationDbContext())
     {
         var collection = new List <LogListItems>();
         foreach (var item in ctx.Logs)
         {
             var newLogListItems = new LogListItems
             {
                 WhatHappened = item.WhatHappened,
                 LogId        = item.LogId
             };
             collection.Add(newLogListItems);
         }
         return(collection);
     }
 }