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;
     }
 }
Example #2
0
 public void InsertRoute(int id, string tuyenDuong)
 {
     try
     {
         RouteDTO dto = new RouteDTO {
             Id = id, TuyenDuong = tuyenDuong
         };
         dao.Add(dto);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }