public ActionResult Find(string q) { IRepositorio<Empresa> repoP = new EmpresaRepositorio(); IList<Empresa> empresas = repoP.GetAll(); IList<Empresa> posiblesEmpresas = new List<Empresa>(); foreach (var item in empresas) { if (item.Nombre.Contains(q.ToUpper()) || item.Nombre.Contains(q.ToLower())) { posiblesEmpresas.Add(item); } } string[] emp = new string[posiblesEmpresas.Count]; int i = 0; foreach (var empresa in posiblesEmpresas) { emp[i] = empresa.Nombre; i++; } return Content(string.Join("\n", emp)); ; }
public ActionResult Index(string empresa) { IRepositorio<Empresa> myRepoEmpresa = new EmpresaRepositorio(); IList<Empresa> listaEmpresa = myRepoEmpresa.GetAll(); IList<Empresa> empresasBuscadas = new List<Empresa>(); if (empresa != null) { foreach (var empresa1 in listaEmpresa) { if (empresa1.Nombre == empresa) { empresasBuscadas.Add(empresa1); } } return View(empresasBuscadas); } return View(listaEmpresa); }
public IEnumerable <Empresa> List() { return(_empresasRepositorio.GetAll()); }
public ActionResult Create(Publicacion p,FormCollection collection) { //Empresa var nombreEmpresa = collection[0]; var repoEmp = new EmpresaRepositorio(); var listaEmp = repoEmp.GetAll(); foreach (var empresa in listaEmp.Where(empresa => empresa.Nombre == nombreEmpresa)) { p.IdEmpresa = empresa.IdEmpresa; } if (String.IsNullOrEmpty(nombreEmpresa) || p.IdEmpresa == 0) { ModelState.AddModelError("NombreE", "Nombre Empresa es Necesario"); return View(p); } if (String.IsNullOrEmpty(p.Pais) || p.Pais.CompareTo("--Seleccione--")==0) { ModelState.AddModelError("Pais", "Pais es Necesario"); return View(p); } if (String.IsNullOrEmpty(p.Estado) || p.Estado.CompareTo("--Seleccione--") == 0) { ModelState.AddModelError("Estado", "Estado es Necesario"); return View(p); } if (String.IsNullOrEmpty(p.Ciudad) || p.Ciudad.CompareTo("--Seleccione--") == 0) { ModelState.AddModelError("Ciudad", "Ciudad es Necesario"); return View(p); } //fin Empresa //Sub Categoria var repoSub = new SubCategoriumRepositorio(); var listaSub = repoSub.GetAll(); var subCategorias = p.SubCategorium.Nombre.Split('-'); var subCategoria = ""; subCategoria = subCategorias[1].Substring(1); p.SubCategorium = new SubCategorium(); foreach (var subCategorium in listaSub.Where(subCategorium => subCategorium.Nombre == subCategoria)) { p.IdSubCategoria = subCategorium.IdSubCategoria; } //fin Sub Categoria var repoPubli = new PublicacionRepositorio(); IList<Idioma> myIdiomas = p.Idioma; p.Idioma = null; var repoLug = new LugarRepositorio(); p.Ciudad = repoLug.GetById(Convert.ToInt32(p.Ciudad)).Nombre; p.Estado = repoLug.GetById(Convert.ToInt32(p.Estado)).Nombre; var idPublicacion = repoPubli.Save(p); //Precios IList<Precio> listaPrecios = p.Precios; var repoPrecios = new PrecioRepositorio(); foreach (var precio in listaPrecios) { precio.IdPublicacion = idPublicacion; repoPrecios.Save(precio); } //fin Precios p.Idioma = myIdiomas; //Servicios if (p.Servicios != null){ var misServicios = new List<Servicio>(p.Servicios); foreach (var misServicio in misServicios) { if (misServicio.IdServicio == 0) continue; var pB = new PublicacionServicio { IdPublicacion = idPublicacion, IdServicio = misServicio.IdServicio }; var repoPubSer = new PublicacionServicioRepositorio(); repoPubSer.Save(pB); } } //fin Servicios //Idioma var repoIdioma = new IdiomaRepositorio(); var idioma = p.Idioma[0]; idioma.IdPublicacion = idPublicacion; if(p.Idioma[0].Categoria != "Otra") { p.Idioma[0].Categoria.Substring(0, 1); repoIdioma.Save(idioma); } else { idioma.Categoria = p.Idioma[1].Categoria; repoIdioma.Save(idioma); } //fin Idioma //Session para las fotos Session["IdPublicacion"] = idPublicacion; return RedirectToAction("Upload"); }
public List <Empresa> PegarTodos() { return(_empresaRepositorio.GetAll()); }
public ActionResult Index() { IRepositorio<Empresa> myRepoEmpresa = new EmpresaRepositorio(); IList<Empresa> listaEmpresa = myRepoEmpresa.GetAll(); return View(listaEmpresa); }
public IEnumerable <Empresas> GetAllEmpresas() { return(repositorio.GetAll()); }