public static List <LibraryItemVM> MappLibraryItemToVM(List <DataLibrary.Models.LibraryItemModel> input) { var output = new List <LibraryItemVM>(); foreach (var item in input) { var model = new LibraryItemVM(); var category = new Category(); if (item.CategoryId > 0) { category = new Category() { Id = CategoryProcessor.EditCategory(item.CategoryId).Id, CategoryName = CategoryProcessor.EditCategory(item.CategoryId).CategoryName }; } model.Author = item.Author; model.BorrowDate = item.BorrowDate; model.Borrower = item.Borrower; model.Category = category; model.Id = item.Id; model.IsBorrowable = item.IsBorrowable; model.Pages = item.Pages; model.RunTimeMinutes = item.RunTimeMinutes; model.Title = item.Title; model.Type = item.Type; output.Add(model); } return(output); }
public static LibraryItemVM MappForEditToVM(DataLibrary.Models.LibraryItemModel item) { var model = new LibraryItemVM(); var category = new Category(); if (item.CategoryId > 0) { category = new Category() { Id = CategoryProcessor.EditCategory(item.CategoryId).Id, CategoryName = CategoryProcessor.EditCategory(item.CategoryId).CategoryName }; } model.Author = item.Author; model.BorrowDate = item.BorrowDate; model.Borrower = item.Borrower; model.Category = category; model.Id = item.Id; model.IsBorrowable = item.IsBorrowable; model.Pages = item.Pages; model.RunTimeMinutes = item.RunTimeMinutes; model.Title = item.Title; model.Type = item.Type; return(model); }
public CompoundModelBuilder(RecipeProcessor recipeProcessor, IngredientProcessor ingredientProcessor, CuisineProcessor cuisineProcessor, CategoryProcessor categoryProcessor) { this.cuisineProcessor = cuisineProcessor; this.recipeProcessor = recipeProcessor; this.ingredientProcessor = ingredientProcessor; this.categoryProcessor = categoryProcessor; }
public IngredientController(IngredientProcessor ingredientProcessor, CategoryProcessor categoryProcessor, IMapper mapper, SessionManager <ItemInfo> sessionManager, CompoundModelBuilder compoundModelBuilder) { this.mapper = mapper; this.ingredientProcessor = ingredientProcessor; this.categoryProcessor = categoryProcessor; this.sessionManager = sessionManager; this.compoundModelBuilder = compoundModelBuilder; }
public static Category GetCategoryById(int id) { var category = new Category(); var tempCategory = CategoryProcessor.EditCategory(id); category.CategoryName = tempCategory.CategoryName; category.Id = tempCategory.Id; return(category); }
public ActionResult Edit(int id) { var output = CategoryProcessor.EditCategory(id); var model = new ConsidÖvning.Models.Category(); model.Id = output.Id; model.CategoryName = output.CategoryName; return(View(model)); }
//Category logic public static LibraryItemVM CleanCategory(LibraryItemVM model) { var category = new Category(); var tempCategory = CategoryProcessor.GetCategoryByName(model.CategoryName); category.CategoryName = tempCategory.CategoryName; category.Id = tempCategory.Id; model.Category = category; return(model); }
public ActionResult Edit(ConsidÖvning.Models.Category modelEdit) { if (ModelState.IsValid) { var outModel = new DataLibrary.Models.CategoryModel() { Id = modelEdit.Id, CategoryName = modelEdit.CategoryName }; CategoryProcessor.SaveCategory(outModel); } return(RedirectToAction("Index")); }
private List <Category> GetCategories() { var output = new List <Category>(); var models = CategoryProcessor.LoadCategories(); foreach (var item in models) { var mod = new Category(); mod.CategoryName = item.CategoryName; mod.Id = item.Id; output.Add(mod); } return(output); }
public ActionResult Delete(int id) { var canDelete = CategoryProcessor.checkReferences(id); if (canDelete) { CategoryProcessor.DeleteCategory(id); } else { return(RedirectToAction("Index", new { flag = true })); } return(RedirectToAction("Index")); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy(MyAllowSpecificOrigins, builder => { builder.WithOrigins("http://www.contoso.com", "https://localhost:4200"); }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSingleton <GraphQuery>(GraphQuery.GetInstance()); services.AddSingleton <GraphProcessor>(GraphProcessor.GetInstance()); services.AddSingleton <CategoryProcessor>(CategoryProcessor.GetInstance()); }
public static LibraryItemModel MappToLibraryItemModelFromVM(LibraryItemVM item) { var model = new LibraryItemModel(); var category = CategoryProcessor.GetCategoryByName(item.Category.CategoryName); model.Author = item.Author; model.BorrowDate = item.BorrowDate; model.Borrower = item.Borrower; model.CategoryId = category.Id; model.Id = item.Id; model.IsBorrowable = item.IsBorrowable; model.Pages = item.Pages; model.RunTimeMinutes = item.RunTimeMinutes; model.Title = item.Title; model.Type = item.Type; return(model); }
public ActionResult Create(Category model) { if (ModelState.IsValid) { var oldCategories = CategoryProcessor.LoadCategories(); foreach (var item in oldCategories) { if (item.CategoryName.ToUpper() == model.CategoryName.ToUpper()) { return(RedirectToAction("Create", new { flag = true })); } } CategoryProcessor.CreateCategory(model.CategoryName); return(RedirectToAction("Index")); } return(RedirectToAction("Create")); }
public ActionResult Index(bool?flag) { var output = CategoryProcessor.LoadCategories(); var models = new List <ConsidÖvning.Models.Category>(); foreach (var item in output) { var cat = new Category(); cat.CategoryName = item.CategoryName; cat.Id = item.Id; models.Add(cat); } if (flag == true) { ViewData["ErrorMessage"] = "You can't delete the category, references to this category exists"; } return(View(models)); }
private void ButtonExecute_Click(object sender, EventArgs e) { //RefreshGrammarTree(GrammarTextBox.Text); RefreshAST(InputTextBox.Text); if (parser.ASTRoot == null) { return; } if (parser.ASTRoot.Type == ASTType.NonterminalEqual) { OutputTextBox.Text = ""; DateTime startCompileTime = DateTime.Now; CategoryProcessor p = new CategoryProcessor(parser.Grammar); DateTime endCompileTime = DateTime.Now; DateTime startTime = DateTime.Now; p.Execute(parser.ASTRoot, parser.Grammar); DateTime endTime = DateTime.Now; OutputTextBox.Text += "Время интерпретации: " + (endCompileTime - startCompileTime) + "\n"; OutputTextBox.Text += "Время вычисления: " + (endTime - startTime) + "\n"; if (!Storage.Local.ContainsKey("Показать")) { return; } foreach (Конус w in Storage.Local["Показать"].Кообласть.Values) { string content = w.Кообласть.Values.Aggregate <Конус, string>("", (c, n) => c == "" ? n.ToString() : c + "," + n.ToString()); OutputTextBox.Text += w.Имя + (content == "" ? "" : "{" + content + "}") + "\n"; } OutputTextBox.Text += "--------------------------------------------\n"; //foreach (Конус w in Storage.Local.Values) //{ // string content = w.Кообласть.Values.Aggregate<Конус, string>("", (c, n) => c == "" ? n.ToString() : c + "," + n.ToString()); // OutputTextBox.Text += w.Имя + (content=="" ? "" : "{" + content+ "}") +"\n"; //} //execForm = new ExecutionForm(); //execForm.Memory = p.Memory; //execForm.Show(); } }
public GcpclassifyController(CategoryProcessor proc) { processor = proc; }
public CategoryController(CategoryProcessor categoryProcessor, IMapper mapper, SessionManager <ItemInfo> sessionManager) { this.sessionManager = sessionManager; this.mapper = mapper; this.categoryProcessor = categoryProcessor; }
public CategoryController(IBudgetRepository budgetRepository) { _budgetRepository = budgetRepository; _categoryProcessor = new CategoryProcessor(_budgetRepository); }