Beispiel #1
0
 public DAO.Ticket createTicket(DAO.Ticket ticket)
 {
     try
     {
         using (var context = new Node2Context())
         {
             var ticketModel = new EntityNode2.Ticket()
             {
                 AccountId          = ticket.AccountId,
                 CreateDate         = ticket.CreateDate,
                 CustomerName       = ticket.CustomerName,
                 Id                 = ticket.Id,
                 ProblemDescription = ticket.ProblemDescription
             };
             context.Ticket.Add(ticketModel);
             context.SaveChanges();
             ticket.Id = ticketModel.Id;
             return(ticket);
         };
     }
     catch (Exception e)
     {
         Console.WriteLine("Ticket not saved");
         throw;
     }
 }
Beispiel #2
0
 public void createBlock(DAO.Block Block)
 {
     try
     {
         using (var context = new Node2Context())
         {
             var blockModel = new EntityNode2.Block()
             {
                 Id           = Block.Id,
                 Hash         = Block.Hash,
                 IdTicket     = Block.IdTicket,
                 PreviousHash = Block.PreviousHash,
             };
             context.Block.Add(blockModel);
             context.SaveChanges();
             Block.Id = blockModel.Id;
         };
     }
     catch (Exception e)
     {
         Console.WriteLine("Ticket not saved");
         throw;
     }
 }