public long GetId(SelectedItemViewModel selectedItemModel) { if (selectedItemModel == null) { return 0; } long id; long.TryParse(selectedItemModel.Id, out id); return id; }
public SelectedItemViewModel GetTheme(string id) { long parseResult; if (long.TryParse(id, out parseResult)) { return GetTheme(parseResult); } else if (!string.IsNullOrEmpty(id)) { var theme = new SelectedItemViewModel() { Id = id, Text = SubjectIdPrefixHelper.Trim(id) }; return theme; } return null; }
private static long? GetSelectedId(SelectedItemViewModel viewModel) { long id; if (viewModel != null && long.TryParse(viewModel.Id, out id)) { return id; } return null; }