Beispiel #1
0
 public DAO.Ticket createTicket(DAO.Ticket ticket)
 {
     try
     {
         using (var context = new Node1Context())
         {
             var ticketModel = new EntityNode1.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 Node1Context())
         {
             var blockModel = new EntityNode1.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;
     }
 }