Exemplo n.º 1
0
 public bool CreateRoute(Route model)
 {
     try
     {
         var route = _db.Get <Route>().FirstOrDefault(x => x.Name == model.Name && x.CardPAN == model.CardPAN);
         if (route != null)
         {
             throw new Exception("Route with this Card PAN already exist");
         }
         else
         {
             return(_db.Add(new Route
             {
                 SinkNode = model.SinkNode,
                 CardPAN = model.CardPAN,
                 Name = model.Name,
                 Description = model.Description
             }));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }