Esempio n. 1
0
 public bool AddLocation(Location location)
 {
     try
     {
         var loc = new DbModel.Location
         {
             Id          = Guid.NewGuid(),
             Name        = location.Name,
             Description = location.Description,
             StatusId    = location.StatusId,
             CreatedDate = DateTime.UtcNow,
             CreatedBy   = _username
         };
         var result      = _transportDataAccess.AddLocation(loc);
         var returnValue = result > 0 ? true : false;
         return(returnValue);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 public Location SearchLocation(Location location)
 {
     try
     {
         var result = new DbModel.Location();
         if (location.Id != Guid.Empty)
         {
             result = _transportDataAccess.SearchLocationById(location.Id);
         }
         else if (!string.IsNullOrWhiteSpace(location.Name))
         {
             result = _transportDataAccess.SearchLocationByName(location.Name);
         }
         else
         {
             result = null;
         }
         if (result != null)
         {
             var returnValue = new Location
             {
                 Id          = result.Id,
                 Name        = result.Name,
                 Description = result.Description
             };
             return(returnValue);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }