private void TabItem_EditBoxLostFocus(object sender, RoutedEventArgs e) { if (sender is JmTabItem tabItem) { tabItem.Editable = false; var name = tabItem.Header.ToString(); if (tabItem.Tag == null) { var userMusicListInfo = new UserMusicListContract() { UserId = App.User.Id, Name = name }; userMusicListInfo = UserMusicListService.Create(userMusicListInfo); tabItem.Tag = userMusicListInfo.Id; tabItem.MouseUp += UserMusicListSelectionChanged; tabItem.ContextMenu = GetContextMenu(); SetSelectedTabItem(tabItem); ChangeUserMusicListPage(Convert.ToInt32(userMusicListInfo.Id)); } else { var id = Convert.ToInt32(tabItem.Tag); UserMusicListService.Update(id, name); } } }
public UserMusicListContract Create(UserMusicListContract userMusicList) { var model = new UserMusicList() { UserId = userMusicList.UserId, Name = userMusicList.Name }; var result = _userMusicListManager.Create(model); userMusicList.Id = result.Id; return(userMusicList); }