Пример #1
0
 public void insertTimeStamp(TimeStamp timeStamp)
 {
     try
     {
         context.TimeStamps.Add(timeStamp);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
     }
 }
Пример #2
0
        public static void Initiliaze(TimeStampContext context)
        {
            context.Database.EnsureCreated();


            if (context.TimeStamps.Any())
            {
                Console.WriteLine("Connecting to the Database");
                return;
            }

            Console.WriteLine("Initializing the Database");

            var timeStamps = new TimeStamp[]
            {
                new TimeStamp
                {
                    TimePunch    = DateTime.Now,
                    EmployeeId   = 1111,
                    IsBreak      = false,
                    PunchIn      = true,
                    PunchInBreak = false
                }
            };

            foreach (var timeStamp in timeStamps)
            {
                context.Add(timeStamp);
                context.SaveChanges();
            }
        }