public static CustomStateDetail GetCustomUnitState(UnitState state) { if (state.State <= 25) { var detail = new CustomStateDetail(); detail.ButtonText = state.ToStateDisplayText(); detail.ButtonColor = state.ToStateCss(); if (string.IsNullOrWhiteSpace(detail.ButtonColor)) { detail.ButtonColor = "label-default"; } return(detail); } else { var customStateService = WebBootstrapper.GetKernel().Resolve <ICustomStateService>(); var stateDetail = customStateService.GetCustomDetailForDepartment(state.Unit.DepartmentId, state.State); return(stateDetail); } }
public static async Task <CustomStateDetail> GetCustomUnitState(UnitState state) { if (state.State <= 25) { var detail = new CustomStateDetail(); detail.ButtonText = state.ToStateDisplayText(); detail.ButtonColor = state.ToStateCss(); if (string.IsNullOrWhiteSpace(detail.ButtonColor)) { detail.ButtonColor = "label-default"; } return(detail); } else { var customStateService = ServiceLocator.Current.GetInstance <ICustomStateService>(); var stateDetail = await customStateService.GetCustomDetailForDepartmentAsync(state.Unit.DepartmentId, state.State); return(stateDetail); } }