private void VerComidaInfo(ElementoMenu comida) { Console.WriteLine($"{comida.NumeroDeComida}\n" + $"{comida.NombreDeComida}\n" + $"{comida.Descripcion}\n" + $"{comida.PrecioDeComida}\n"); Console.WriteLine("-----------------------------------"); }
private void ConseguirComidasPorID() { Console.Clear(); Console.WriteLine("Ingrese un numero de comida."); int entradaIDComida = Convert.ToInt32(Console.ReadLine()); ElementoMenu menuItem = _repoComida.ConseguirComidasById(entradaIDComida); VerComidaInfo(menuItem); }
public void Arrange() { pollo = new ElementoMenu(1, "Sobroso Pollo y Parrilla", "Muy sobroso!", 3.99m); _menuRepo = new MenuRepository(); _menuRepo.CrearElementoNuevo(pollo); menu = _menuRepo.ConseguirTodasComidas(); }
public static MvcHtmlString ElementoMenu(this HtmlHelper helper, ElementoMenu elemento) { MvcHtmlString submenu, iconoFlecha, icono; if (elemento.TieneHijos) { submenu = MenuPrincipal(helper, elemento.Hijos, new { @class = "sub-menu" }); var flecha = new TagBuilder("i"); flecha.AddCssClass("icon-arrow"); iconoFlecha = MvcHtmlString.Create(flecha.ToString(TagRenderMode.Normal)); } else { submenu = MvcHtmlString.Create(""); iconoFlecha = MvcHtmlString.Create(""); } var texto = new TagBuilder("span"); texto.AddCssClass("title"); texto.SetInnerText(elemento.Texto); if (!String.IsNullOrWhiteSpace(elemento.ClaseIcono)) { var ico = new TagBuilder("i"); ico.AddCssClass(elemento.ClaseIcono); icono = MvcHtmlString.Create(ico.ToString(TagRenderMode.Normal)); } else { icono = MvcHtmlString.Create(""); } var selected = new TagBuilder("span"); selected.AddCssClass("selected"); var enlace = new TagBuilder("a"); string area = string.IsNullOrWhiteSpace(elemento.Area) ? "" : $"{elemento.Area}"; string modulo = string.IsNullOrWhiteSpace(elemento.Modulo) ? "" : $"#/{elemento.Modulo}"; string sufijo = $"{area}{modulo}"; enlace.MergeAttribute("href", string.IsNullOrEmpty(sufijo) ? "javascript:void(0);" : sufijo); enlace.InnerHtml += icono; enlace.InnerHtml += MvcHtmlString.Create(texto.ToString(TagRenderMode.Normal)); enlace.InnerHtml += iconoFlecha; enlace.InnerHtml += MvcHtmlString.Create(selected.ToString(TagRenderMode.Normal)); var li = new TagBuilder("li"); li.InnerHtml += MvcHtmlString.Create(enlace.ToString(TagRenderMode.Normal)); li.InnerHtml += submenu; return(MvcHtmlString.Create(li.ToString(TagRenderMode.Normal))); }
public void ConseguirComidasById() { //Arrange string expected = "Sobroso Pollo y Parrilla"; //Act ElementoMenu item = _menuRepo.ConseguirComidasById(1); //Assert Assert.AreEqual(expected, item.NombreDeComida); }
public void ConseguirTodasComidas() { //Arrange int expected = 2; ElementoMenu pollo2 = new ElementoMenu(1, "Sobroso Pollo y Parrilla", "Muy sobroso!", 3.99m); //Act _menuRepo.CrearElementoNuevo(pollo2); Console.WriteLine(menu.Count); //Assert Assert.AreEqual(expected, menu.Count); }
private void CrearElementoNuevo() { Console.Clear(); ElementoMenu elementoMenu = new ElementoMenu(); Console.WriteLine("Ingrese un numero de comida."); int entradaIDComida = Convert.ToInt32(Console.ReadLine()); elementoMenu.NumeroDeComida = entradaIDComida; //elementoMenu.NumeroDeComida = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingrese nombre de comida."); string entradaComidaNombre = Console.ReadLine(); elementoMenu.NombreDeComida = entradaComidaNombre; //Description Console.WriteLine("Ingerse una descripcion de comida."); string entradaDescripcionComida = Console.ReadLine(); //Call POCO Call Property = User Input elementoMenu.Descripcion = entradaDescripcionComida; //List of Ingredients bool tieneIngredientesTodo = false; while (tieneIngredientesTodo == false) //while the boolean is false run this stuff, while hasallingredients is false { Console.WriteLine("Quieres agregar algunos ingredientes: y/n?"); string entradaIngrediente = Console.ReadLine(); if (entradaIngrediente == "y" || entradaIngrediente == "Y") { Console.WriteLine("Ingrese un ingrediente."); string entradaValor = Console.ReadLine(); elementoMenu.Ingredientes.Add(entradaValor); } if (entradaIngrediente == "n" || entradaIngrediente == "N") { tieneIngredientesTodo = true; } } //Price Console.WriteLine("What is the price?"); decimal entradaPrecio = decimal.Parse(Console.ReadLine()); elementoMenu.PrecioDeComida = entradaPrecio; _repoComida.CrearElementoNuevo(elementoMenu); }
private void Semillas() { //We added another constructor because we were only passing two parameters, not 5 or 0. ElementoMenu pollo = new ElementoMenu(1, "Sobroso Pollo y Parrilla", "Muy sobroso!", 4.99m); ElementoMenu tocino = new ElementoMenu(2, "Tocino Cajun Casero", "Sabor excellente", 4.99m); ElementoMenu jamon = new ElementoMenu(3, "Jamon Ahumado", "Muy delicioso!", 4.99m); ElementoMenu rosbif = new ElementoMenu(4, "Rosbif Simple y Aburrido", "Simply, aburrido y perfectamente", 4.99m); ElementoMenu pavo = new ElementoMenu(5, "Golpea a Tu Madre Pavo!", "Si, es tan bueno!", 5.99m); _repoComida.CrearElementoNuevo(pollo); _repoComida.CrearElementoNuevo(tocino); _repoComida.CrearElementoNuevo(jamon); _repoComida.CrearElementoNuevo(rosbif); _repoComida.CrearElementoNuevo(pavo); }
public void SetComidaNombre_EstableceEntradaCorrecto() { // Parameters here - Just like the SEED method ElementoMenu comida = new ElementoMenu(); List <ElementoMenu> _menuDirectory = new List <ElementoMenu>(); List <ElementoMenu> menu = _menuDirectory.ConseguirTodasComidas(); comida.NombreDeComida = "Sandwich"; string esperado = "Sandwich"; string real = comida.NombreDeComida; Assert.AreEqual(esperado, real); }
private async void PossibleLog_ItemTapped(object sender, ItemTappedEventArgs e) { if (sender is ListView lv) { lv.SelectedItem = null; } ElementoMenu em = (ElementoMenu)e.Item; if (em.testo == "Accedi con Google") { await Task.Run(() => { DependencyService.Get <INativePages>().StartPage(); }); Navigation.InsertPageBefore(new WelcomePage(), this); await Navigation.PopAsync(); } else if (em.testo == "Accedi con Facebook") { await Task.Run(() => { DependencyService.Get <INativePages>().FacebookStartPage(); }); Navigation.InsertPageBefore(new WelcomePage(), this); await Navigation.PopAsync(); } }
private async void Menu_ItemTapped(object sender, ItemTappedEventArgs e) { if (sender is ListView lv) { lv.SelectedItem = null; } ElementoMenu em = (ElementoMenu)e.Item; if (em.testo == "Diventa insegnante") { /*if (Preferences.Get("isInsegnante", false) == true) * await Navigation.PushAsync(new ProfilePage2(new Insegnante())); //sarà da mettere l'insegnante corrente * else * {*/ if (Preferences.Get("id", null) == null) { //await Navigation.PushAsync(new AccountPage()); Navigation.InsertPageBefore(new AccountPage(), this); await Navigation.PopAsync(); } else { Navigation.InsertPageBefore(new EditProfilePage(new Insegnante()), this); await Navigation.PopAsync(); } } else if (em.testo == "Profilo insegnante") { Insegnante i = await InsegnantiService.getInsegnante(int.Parse(Preferences.Get("id", (-1).ToString()))); //occhio al null if (i.id != 0) { //Navigation.InsertPageBefore(new ProfilePage2(i, "menu"), this); //await Navigation.PopAsync(); await Navigation.PushAsync(new ProfilePage2(i, "menu")); } } else if (em.testo == "Insegnanti salvati") { this.IsEnabled = false; //await Navigation.PushAsync(new ProfilePage(new Insegnante())); if (Preferences.Get("id", null) != null) { RisultatoRicercaInsegnanti[] risultati = await InsegnantiService.getPreferiti(int.Parse(Preferences.Get("id", null))); //eventualmente da spostare nella PreferitiPage Navigation.InsertPageBefore(new PreferitiPage(risultati), this); await Navigation.PopAsync(); } else { Navigation.InsertPageBefore(new AccountPage(), this); await Navigation.PopAsync(); } this.IsEnabled = true; } else if (em.testo == "Accedi o crea il tuo Account") { Navigation.InsertPageBefore(new AccountPage(), this); await Navigation.PopAsync(); } else if (em.testo == "Il tuo account") { Navigation.InsertPageBefore(new UserAccountPage(), this); await Navigation.PopAsync(); } //Navigation.InsertPageBefore(page, this); //await Navigation.PopAsync(); }