/// <summary> /// Create from domain model [for dropdowns] /// </summary> public static WorkPlaceDropdown CreateFromm(this WorkPlace source) { return(new WorkPlaceDropdown { WorkPlaceId = source.WorkPlaceId, WorkPlaceCodeName = source.WorkPlaceCode + " - " + source.WorkPlaceName, CompanyId = source.WorkLocation.Company != null ? source.WorkLocation.Company.CompanyId : 0 }); }
/// <summary> /// Create From Domain model /// </summary> public static Models.WorkPlace CreateFrom(this WorkPlace source) { return(new Models.WorkPlace { WorkPlaceId = source.WorkPlaceId, WorkPlaceCode = source.WorkPlaceCode, WorkPlaceName = source.WorkPlaceName, WorkPlaceDescription = source.WorkPlaceDescription, CompanyId = source.WorkLocation.CompanyId, CompanyName = source.WorkLocation.Company.CompanyName, ParentWorkPlaceId = source.ParentWorkPlaceId, ParentWorkPlaceName = source.ParentWorkPlaceId != null ? source.ParentWorkPlace.WorkPlaceName : "", WorkPlaceTypeId = source.WorkPlaceTypeId, WorkPlaceTypeName = source.WorkPlaceType.WorkPlaceTypeName, WorkLocationId = source.WorkLocationId, WorkLocationName = source.WorkLocation.WorkLocationName, OperationsWorkPlaces = source.OperationsWorkPlaces != null?source.OperationsWorkPlaces.Select(operationWorkPlace => operationWorkPlace.CreateFrom()).ToList() : null }); }