예제 #1
0
 public static Search.Models.PlantLocation AsSearchModel(this PlantLocation source) => new Search.Models.PlantLocation
 {
     Id                 = source.Id,
     Status             = !string.IsNullOrEmpty(source.Status) ? Enum.Parse <LocationStatus>(source.Status) : LocationStatus.Unknown,
     ConservationStatus = !string.IsNullOrEmpty(source.ConservationStatus) ? Enum.Parse <ConservationStatus>(source.ConservationStatus) : ConservationStatus.Unknown,
     Location           = source.Location?.AsSearchModel(),
     CreatedBy          = source.CreatedBy,
     ModifiedBy         = source.ModifiedBy,
     DateCreated        = source.DateCreated,
     DateModified       = source.DateModified
 };
예제 #2
0
 public static Models.PlantLocation AsModel(this PlantLocation source) => new Models.PlantLocation
 {
     Id                 = source.Id,
     Status             = !string.IsNullOrEmpty(source.Status) ? Enum.Parse <LocationStatus>(source.Status) : LocationStatus.Unknown,
     ConservationStatus = !string.IsNullOrEmpty(source.ConservationStatus) ? Enum.Parse <ConservationStatus>(source.ConservationStatus) : ConservationStatus.Unknown,
     Location           = source.Location != null?source.Location.AsModel() : new Models.Location
     {
         LocationId = source.LocationId
     },
     PlantInfo = source.PlantInfo != null?source.PlantInfo.AsModel() : new Models.PlantInfo
     {
         PlantInfoId = source.PlantInfoId
     },
     CreatedBy    = source.CreatedBy,
     ModifiedBy   = source.ModifiedBy,
     DateCreated  = source.DateCreated,
     DateModified = source.DateModified
 };