public ActionResult Index()
        {
            var biz   = new EspecieProcess();
            var lista = biz.ListarTodos();

            return(View(lista));
        }
        public ActionResult ExportarEspeciesCSV()
        {
            var biz      = new EspecieProcess();
            var especies = biz.ListarTodos();


            var stream       = new MemoryStream();
            var streamWriter = new StreamWriter(stream, Encoding.Default);

            foreach (var item in especies)
            {
                var properties = typeof(Especie).GetProperties();
                foreach (var prop in properties)
                {
                    streamWriter.Write(GetValue(item, prop.Name));
                    streamWriter.Write(", ");
                }
                streamWriter.WriteLine();
            }

            streamWriter.Flush();
            stream.Position = 0;

            return(File(stream, "text/csv"));
        }
        public JsonResult Search(string term)
        {
            EspecieProcess ep       = new EspecieProcess();
            var            especies = ep.ListarTodos();
            var            result   = especies.Where(i => i.Nombre.Contains(term)).ToList();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public void ExportarEspeciesXML()
        {
            var biz      = new EspecieProcess();
            var especies = biz.ListarTodos();

            var serializer = new XmlSerializer(especies.GetType());

            Response.ContentType = "text/xml";
            serializer.Serialize(Response.Output, especies);
        }