protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var viewModel = new CategoriesModelView(); var window = new CategoriesView { DataContext = viewModel }; window.ShowDialog(); }
public ActionResult Category(int page = 1) { byte PageSize = 10; IEnumerable <Category> categories = db.Categories.OrderByDescending(c => c.Name).Skip((page - 1) * PageSize).Take(PageSize); PageInfo pageInfo = new PageInfo { PageNumber = page, PageSize = PageSize, TotalItems = db.Categories.Count() }; CategoriesView model = new CategoriesView(); model.Categories = categories; model.pageInfo = pageInfo; return(View(model)); }
public IHttpActionResult Update([FromBody] CategoriesView categoriesView) { var category = mapper.Map <CategoriesDTM>(categoriesView); try { service.UpdateAsync(category); return(Ok()); } catch { return(NotFound()); } }
public HttpResponseMessage Add([FromBody] CategoriesView categoryView) { HttpResponseMessage responseMessage; var category = mapper.Map <CategoriesDTM>(categoryView); try { service.AddAsync(category); responseMessage = new HttpResponseMessage(HttpStatusCode.OK); } catch { responseMessage = new HttpResponseMessage(HttpStatusCode.NotAcceptable); responseMessage.Content = new StringContent("Name can`t be empty!"); } return(responseMessage); }
public Form2() { InitializeComponent(); SuspendLayout(); ListItems(Receiver.ReadFromProduct("SELECT * FROM Product;")); List <string> CL = FetchData.AllCategories(); ViewedCategories = new List <CategoriesView>(); timer.Interval = 50; timer.Tick += Timer_Tick; timer.Start(); foreach (string s in CL) { CategoriesView C = new CategoriesView(s, Categories, this); ViewedCategories.Add(C); } ResumeLayout(); }
public MainViewModel() { Categories = new ObservableRangeCollection <CategoryModel>(); Task.Run(SetCategories); SerializeTableCommand = new RelayCommand( async obj => await ExecuteSerializeTableCommand()); CategorizeTableCommand = new RelayCommand( async obj => await ExecuteCategorizeTableCommand()); CategoriesCommand = new RelayCommand(obj => { var view = new CategoriesView(Categories); view.ShowDialog(); ConsoleWrite("Созданы категории сортировки..."); }); GenerateSourcesCommand = new RelayCommand( async obj => await ExecuteGenerateSourcesCommand()); FileSelectCommand = new RelayCommand(obj => { FilePath = FileManager.OpenFile(RootDirectory); RootDirectory = new FileInfo(FilePath).DirectoryName; ConsoleWrite("Задан файл конфигурации..."); }); CreateDbCommand = new RelayCommand(async obj => await ExecuteCreateDbCommand()); OpenDbCommand = new RelayCommand(async obj => await ExecuteOpenDbCommand()); FilterLogCommand = new RelayCommand(ExecuteFilterLogCommand); InitFilter(); RootDirectory = @"s:\Simatek\OneClick\"; //Environment.CurrentDirectory; tokenSource = new CancellationTokenSource(); token = tokenSource.Token; ConsoleWrite("Initialized..."); BindingOperations.EnableCollectionSynchronization(LogItems, SyncLock); XmlFilesProcessingCommand = new RelayCommand( async obj => await ExecuteXmlFilesProcessingCommand()); }
public App() { InitializeComponent(); MainPage = new SplashView(); var dataService = new AzureDataService(); dataService.Initialize() .ContinueWith(t => { if (t.IsFaulted) { Debug.WriteLine("Faulted"); } var categoriesPage = new CategoriesView(); NavigationPage root = new NavigationPage(categoriesPage); IFileHelper fileHelper = DependencyService.Get <IFileHelper>(); categoriesPage.ViewModel = new CategoriesViewModel(dataService, root.Navigation, fileHelper); MainPage = root; }, TaskScheduler.FromCurrentSynchronizationContext()); }
protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item) { CategoriesView.RemoveLoadingScreen(); return(tableView.DequeueReusableCell(_cellId)); }