Ejemplo n.º 1
0
 public bool AddBusroute(Busroute busroute)
 {
     try
     {
         var bus = new DbModel.BusRoute
         {
             Id          = Guid.NewGuid(),
             Name        = busroute.Name,
             Description = busroute.Description,
             LocationId  = busroute.LocationId,
             StatusId    = busroute.StatusId,
             CreatedDate = DateTime.UtcNow,
             CreatedBy   = _username
         };
         var result      = _transportDataAccess.AddBusroute(bus);
         var returnValue = result > 0 ? true : false;
         return(returnValue);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
 public Busroute SearchBusroute(Busroute busroute)
 {
     try
     {
         var result = new DbModel.BusRoute();
         if (busroute.Id != Guid.Empty)
         {
             result = _transportDataAccess.SearchBusRouteById(busroute.Id);
         }
         else if (!string.IsNullOrWhiteSpace(busroute.Name))
         {
             result = _transportDataAccess.SearchBusRouteByName(busroute.Name);
         }
         else
         {
             result = null;
         }
         if (result != null)
         {
             var returnValue = new Busroute
             {
                 Id          = result.Id,
                 Name        = result.Name,
                 Description = result.Description
             };
             return(returnValue);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }