public async Task <IActionResult> CustomizeFooter() { var cssString = ""; var hasBgColor = Request.Form.Keys.Any(k => k == "footer-bg"); var bgColor = hasBgColor ? Request.Form["footer-bg"].ToString() : "#ffffff"; cssString += $".footer-bg{{background-color:{bgColor}}}"; var hasTextColor = Request.Form.Keys.Any(k => k == "footer-text"); var textColor = hasTextColor ? Request.Form["footer-text"].ToString() : "#000000"; cssString += $".footer-text{{color:{textColor}}}"; await WriteCss("footer", cssString); ViewBag.Message = $"Successfully updated the footer."; var model = new CustomizeViewModel { NavBar = await ReadCssColorProperties("navbar"), Footer = await ReadCssColorProperties("footer") }; return(View("Customize", model)); }
public async Task <IActionResult> Customize() { var model = new CustomizeViewModel { NavBar = await ReadCssColorProperties("navbar") }; return(View(model)); }
public async Task <IActionResult> CustomizeNavBar() { var cssString = ""; var hasLogo = Request.Form.Files.Any(); if (hasLogo) { var file = Request.Form.Files[0]; if (file.FileName.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase)) { var fi = new FileInfo(file.FileName); var webPath = _hostingEnvironment.WebRootPath; var path = Path.Combine("", webPath + @"\images\logo.png"); using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); } } else { ViewBag.Style = "alert-warning"; ViewBag.Message = $"Only .png file supported. Please choose a different file and try again."; var m = new CustomizeViewModel { NavBar = await ReadCssColorProperties("navbar"), Footer = await ReadCssColorProperties("footer") }; return(View("Customize", m)); } } var hasBgColor = Request.Form.Keys.Any(k => k == "navbar-bg"); var bgColor = hasBgColor ? Request.Form["navbar-bg"].ToString() : "#ffffff"; cssString += $".navbar-bg{{background-color:{bgColor}}}"; var hasTextColor = Request.Form.Keys.Any(k => k == "navbar-text"); var textColor = hasTextColor ? Request.Form["navbar-text"].ToString() : "#000000"; cssString += $".navbar-text{{color:{textColor}}}"; await WriteCss("navbar", cssString); ViewBag.Message = $"Successfully updated the navigation bar."; var model = new CustomizeViewModel { NavBar = await ReadCssColorProperties("navbar"), Footer = await ReadCssColorProperties("footer") }; return(View("Customize", model)); }
public TextureView() { InitializeComponent(); this.textureViewModel = new TextureViewModel(this); this.DataContext = this.textureViewModel; CustomizeViewModel customizeViewModel = new CustomizeViewModel(null); this.ExportContextMenu.DataContext = customizeViewModel; this.ExportFormatLabel.DataContext = customizeViewModel; }
public async Task <IActionResult> CustomizeHomepage() { var hasImage = Request.Form.Files.Any(); if (hasImage) { var file = Request.Form.Files[0]; if (file.FileName.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase)) { var webPath = _hostingEnvironment.WebRootPath; var path = Path.Combine("", webPath + @"\images\homepageimage.png"); using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); } } else { ViewBag.Style = "alert-warning"; ViewBag.Message = $"Only .png file supported. Please choose a different file and try again."; var m = new CustomizeViewModel { NavBar = await ReadCssColorProperties("navbar"), Footer = await ReadCssColorProperties("footer") }; return(View("Customize", m)); } } if (Request.Form.Keys.Contains("headline")) { var headline = Request.Form["headline"].ToString(); if (!string.IsNullOrEmpty(headline)) { var cssString = $"#headlinehomepage::after{{content: '{headline}';}}"; await WriteCss("homepage", cssString); } } ViewBag.Message = $"Successfully updated the homepage."; var model = new CustomizeViewModel { NavBar = await ReadCssColorProperties("navbar"), Footer = await ReadCssColorProperties("footer") }; return(View("Customize", model)); }
public async Task <IActionResult> OnPostAddCustomizeToBasketAsync(CustomizeViewModel product) { if (product.CatalogItemId == null) { return(RedirectToPage("/Customize")); } await SetBasketModelAsync(); //_basketService.AddItemToBasket(BasketModel.Id, product.CatalogItemId.Value, 0, 1, isFromCustomize) return(RedirectToPage("./Result")); }
public CustomizeViewModel BuildCustomizeViewModel(int id) { var dish = _context.Dishes .Single(d => d.DishId == id); var dishIngredients = _context.DishIngredients .Include(di => di.Ingredient) .Where(di => di.DishId == id) .OrderBy(di => di.IngredientId) .ToList(); var allIngredients = _context.Ingredients .OrderBy(i => i.IngredientId) .ToList(); var list = new List <SelectListItem>(); foreach (var ingredient in allIngredients) { if (dishIngredients.Exists(i => i.IngredientId == ingredient.IngredientId)) { var ingredientChecked = new SelectListItem { Value = ingredient.IngredientId.ToString(), Selected = true, Text = ingredient.Name }; list.Add(ingredientChecked); } else { var ingredientNotChecked = new SelectListItem { Value = ingredient.IngredientId.ToString(), Text = ingredient.Name }; list.Add(ingredientNotChecked); } } var viewModel = new CustomizeViewModel { Dish = dish, Ingredients = list }; return(viewModel); }
public async Task <IActionResult> OnPostAsync(CustomizeViewModel model) { CustomizeModel = model; var basketId = await SetBasketModelAsync(); await _service.AddCustomizeItemToBasket(basketId, model); //var user = await _userManager.GetUserAsync(User); //if (user != null) //{ // CustomizeModel.BuyerEmail = user.Email; // CustomizeModel.BuyerName = $"{user.FirstName} {user.LastName}"; // CustomizeModel.BuyerPhone = user.PhoneNumber; //} StatusMessage = "O seu produto personalizado foi adicionado ao carrinho!"; return(RedirectToPage("./Index", "", "")); }
private void OnNavigation(string destination) { switch (destination) { case "play": CurrentViewModel = new PlayViewModel(); break; case "player": CurrentViewModel = new PlayerViewModel(); break; case "customize": CurrentViewModel = new CustomizeViewModel(); break; case "statistics": CurrentViewModel = new StatisticsViewModel(); break; default: throw new ArgumentException($"Failed to navigate to '{destination}', the destination was not recognized"); } }
public CustomizeSettingsView() { InitializeComponent(); DataContext = new CustomizeViewModel(this); }