示例#1
0
        public Guid InsertNewNote(Guid id, string purpose)
        {
            LogBook note = new LogBook
            {
                EntryTime    = DateTime.Now,
                VisitorId    = id,
                VisitPurpose = purpose
            };

            try
            {
                context.LogBooks.Add(note);
                context.SaveChanges();
                Console.WriteLine("\nДанные записаны!");
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            finally
            {
                Console.Write("Нажмите Enter чтобы продолжить...");
                Console.ReadLine();
            }
            return(note.Id);
        }
 public void InsertNewVisitor(Visitor visitor)
 {
     try
     {
         context.Visitors.Add(visitor);
         context.SaveChanges();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception.Message);
     }
 }