/// <summary> /// Método para el acceso a la interfaz de modificación de restaurantes. /// </summary> /// <returns>Retorna un objeto para renderizar la vista parcial.</returns> public ActionResult M10_GestionRestaurantes_Modificar(int id) { try { //Atributos del metodo Entidad _restaurant = FabricaEntidad.crearRestaurant(); ((CRestauranteModelo)_restaurant)._id = id; Command <Entidad> comando = (Command <Entidad>)FabricaComando.comandosRestaurant(FabricaComando.comandosGlobales.CONSULTAR, BOReserva.Controllers.PatronComando.FabricaComando.comandoRestaurant.CONSULTAR_ID, _restaurant); Entidad rest = comando.ejecutar(); //Cargar la ciudad donde se encuentra el restaurant registrado en la base de datos ViewBag.Ciudad = FabricaVista.asignarItemsComboBoxConPosicion(cargarComboBoxLugar(), "Id", "Name", ((CRestauranteModelo)rest).idLugar); ViewBag.HorariosIni = FabricaVista.asignarItemsComboBoxConPosicion(cargarComboBoxHorario(), "", "", ((CRestauranteModelo)rest).horarioApertura); ViewBag.HorariosFin = FabricaVista.asignarItemsComboBoxConPosicion(cargarComboBoxHorario(), "", "", ((CRestauranteModelo)rest).horarioCierre); //Elementos a cargar en la Ventana ViewBag.Id = ((CRestauranteModelo)rest)._id; ViewBag.NombreRestaurant = ((CRestauranteModelo)rest).nombre; ViewBag.DescripcionRestaurant = ((CRestauranteModelo)rest).descripcion; ViewBag.DireccionRestaurant = ((CRestauranteModelo)rest).direccion; ViewBag.TelefonoRestaurant = ((CRestauranteModelo)rest).Telefono; ViewBag.IdLugarRestaurant = ((CRestauranteModelo)rest).idLugar; ViewBag.HoraIniRestaurant = ((CRestauranteModelo)rest).horarioApertura; ViewBag.HoraFinRestaurant = ((CRestauranteModelo)rest).horarioCierre; return(PartialView()); } catch (Exception) { return(PartialView()); } }
/// <summary> /// Método para el acceso a la interfaz de visualización de restaurantes. /// </summary> /// <returns>Retorna un objeto para renderizar la vista parcial.</returns> public ActionResult M10_GestionRestaurantes_Ver(int id = -1) { //Carga Inicial de la vista ver se coloca por defecto un -1 debido a que no hay una ciudad seleccionada por defecto try { ViewBag.Ciudad = FabricaVista.asignarItemsComboBox(cargarComboBoxLugar(), "Id", "Name"); Entidad _lugar = FabricaEntidad.crearLugar(id, "");//Aqui se envia la clave foranea de lugar para realizar la busqueda Command <List <Entidad> > comando = (Command <List <Entidad> >)FabricaComando.comandosRestaurant(FabricaComando.comandosGlobales.CONSULTAR, BOReserva.Controllers.PatronComando.FabricaComando.comandoRestaurant.NULO, _lugar); List <Entidad> restaurantes = comando.ejecutar(); CRestauranteModelo Restaurant = FabricaEntidad.crearRestaurant(); List <CRestauranteModelo> lista = FabricaEntidad.crearListaRestarant(); foreach (Entidad item in restaurantes) { lista.Add((CRestauranteModelo)item); } Restaurant.listaRestaurantes = lista; return(PartialView(Restaurant)); } catch (Exception) { return(PartialView()); } }
public void M10_PruebaAsignarItemsConPosicion() { List <String> lista = new List <String> { "Posicion1", "Posicion2", "Posicion3" }; SelectList listaS = FabricaVista.asignarItemsComboBoxConPosicion(new List <Object>(), "", "", "Posicion2"); Assert.AreEqual(listaS.SelectedValue, "Posicion2"); }
public void M10_PruebaAsignarItemsComboBox() { Assert.IsInstanceOf(typeof(SelectList), FabricaVista.asignarItemsComboBox(new List <Object>(), "", "")); }
/// <summary> /// Método para el acceso a la interfaz de agregación de restaurantes. /// </summary> /// <returns>Retorna un objeto para renderizar la vista parcial.</returns> public ActionResult M10_GestionRestaurantes_Agregar() { ViewBag.Ciudad = FabricaVista.asignarItemsComboBox(cargarComboBoxLugar(), "Id", "Name"); ViewBag.Horarios = FabricaVista.asignarItemsComboBox(cargarComboBoxHorario(), "", ""); return(PartialView()); }