private void OnClick_NegativeBtn(object sender, RoutedEventArgs e) { if (NegativeBtn.Content as string == "No") { ParentView.Show_MessageView("El platillo se ha guardado con éxito", //affirmative action delegate { ParentView.Show_DishesView(); }, "Aceptar", //negative action null, null, FontAwesome.WPF.FontAwesomeIcon.CheckCircle ); } else { ParentView.Show_AddDishPhoto(_dish); } }
private void SaveBtn_Click(object sender, RoutedEventArgs e) { var lineParsed = Enum.TryParse(LineCmb.Text, out DishesLine dishLine); if (NameTxt.Text == "" || NameTxt.Text == " " || NameTxt.Text == string.Empty) { WarningTbk.Text = "Ingrese el nombre del platillo antes de guardarlo"; WarningTbk.Visibility = Visibility.Visible; } else if (TotalCost <= 0) { WarningTbk.Text = "Ingrese ingredientes antes de guardar el platillo"; WarningTbk.Visibility = Visibility.Visible; } else if (PortionCost <= 0) { WarningTbk.Text = "Ingrese el número de porciones antes de guardar el platillo"; WarningTbk.Visibility = Visibility.Visible; } else if (!lineParsed || LineCmb.Text == "-Seleccione una opción-") { WarningTbk.Text = "Verifique que haya seleccionado la linea a la que pertenece el platillo"; WarningTbk.Visibility = Visibility.Visible; } else { _dish.Instructions = InstructionsTxt.Text; _dish.Name = NameTxt.Text; _dish.Portions = Int32.Parse(PortionsTxt.Text); _dish.Line = dishLine; _dish.Notes = NotesTxt.Text; using (var db = App.DbFactory.Open()) { db.Update(_dish); } ParentView.Show_AddDishPhoto(_dish); } }