private Showroom guardarSeccionCuerpo(Showroom showroom, int IdCuerpo, bool esNuevoCuerpo, string tipoDeLetraCuerpo) { if (IdCuerpo != 0) { if (showroom.tieneBanner() && !esNuevoCuerpo) { if (showroom.Cuerpo == null) { showroom.Cuerpo = CuerpoDao.get(_context, Convert.ToInt32(showroom.CuerpoID)); } showroom.Cuerpo.llenarParaEdicion(null, null, null, tipoDeLetraCuerpo); } else { showroom.CuerpoID = IdCuerpo; ElementoMenuDAD elemento = _context.ElementosMenuDADs.Single(m => m.ID == IdCuerpo); Cuerpo cuerpo = new Cuerpo { Showroom = showroom, TipoDeLetra = "", Html = elemento.Html, UrlLogo = "" }; showroom.Cuerpo = cuerpo; showroom.CuerpoID = IdCuerpo; } } CuerpoDao.grabarActualizar(_context, showroom.Cuerpo); //ShowroomDao.grabar(_context, showroom); return(showroom); }
public DataModel OptenerHtmlCuerpo(int idCuerpo) { Cuerpo cuerpo = null; if (idCuerpo != 0) { cuerpo = CuerpoDao.get(_context, idCuerpo); } DataModel respuesta = new DataModel(); respuesta.data.Add("html", cuerpo != null ? cuerpo.Html : ""); return(respuesta); }
public IActionResult Ver(int id) { ShowroomVerModelAndView model = new ShowroomVerModelAndView(); Negocio negocio = NegocioDao.get(_context, id); Showroom showroom = new Showroom(); Banner banner = new Banner(); Cuerpo cuerpo = new Cuerpo(); model.llenarDatosGenerales(HttpContext, _context); if (negocio.Showroom != null || negocio.ShowroomID != null) { if (negocio.ShowroomID != null) { showroom = ShowroomDao.get(_context, Convert.ToInt32(negocio.ShowroomID)); } else { showroom = negocio.Showroom; } } if (showroom.Banner != null || showroom.BannerID != null) { if (showroom.BannerID != null) { banner = BannerDao.get(_context, Convert.ToInt32(showroom.BannerID)); } else { banner = showroom.Banner; } } if (showroom.Cuerpo != null || showroom.CuerpoID != null) { if (showroom.CuerpoID != null) { cuerpo = CuerpoDao.get(_context, Convert.ToInt32(showroom.CuerpoID)); } else { cuerpo = showroom.Cuerpo; } } model.Showroom = showroom; model.Banner = banner; model.Cuerpo = cuerpo; //model.llenarElmentos(_context, negocio); return(View(model)); }
/// <summary> /// Llenar los elementos del modelo /// </summary> /// <param name="_context"></param> public void llenarElmentos(HiShopContext _context, Entity.Negocio negocio) { this.showroom = ShowroomDao.get(_context, Convert.ToInt32(negocio.ShowroomID.ToString())); if (this.showroom.tieneBanner()) { this.showroom.Banner = BannerDao.get(_context, Convert.ToInt32(this.showroom.BannerID.ToString())); } else { this.showroom.Banner = new Banner(); } if (this.showroom.tieneCuerpo()) { this.showroom.Cuerpo = CuerpoDao.get(_context, Convert.ToInt32(this.showroom.CuerpoID.ToString())); } else { this.showroom.Cuerpo = new Cuerpo(); } }