public ActionResult Index(IFormCollection collection) { var c = repoContrato.ObtenerTodos(); ViewBag.vigentes = repoContrato.ObtenerVigentes(DateTime.Now); if (collection["fechaInicial"].ToString().Length != 0 && collection["fechaFinal"].ToString().Length != 0) { var fechaInicial = DateTime.Parse(collection["fechaInicial"]); var fechaFinal = DateTime.Parse(collection["fechaFinal"]); ViewBag.buscadorcontrato1 = repoInmueble.ObtenerInmueblesLibres(fechaInicial, fechaFinal); ViewBag.tab = "1"; } if (collection["direccion"].ToString().Length != 0) { var dire = collection["direccion"]; ViewBag.buscadorcontrato2 = repoContrato.ObtenerTodosLosContratosDeInmueble(dire); ViewBag.tab = "2"; } return(View(c)); }