using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace web_map.Controllers
{
    public class HomeController : Controller
    {
        ModelData.BusinessModel.ExtraEntities.SerialazService serialazService = 
            new ModelData.BusinessModel.ExtraEntities.SerialazService();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult FAQ()
        {
            ViewBag.Message = "FAQ page.";

            return View();
        }

        public ActionResult GetDoc(string fileName)
        {
            string path = Server.MapPath("~/App_Data") + "/html/index.html";
            System.IO.FileInfo file = new System.IO.FileInfo(path);
            if (file.Exists)
                return File(file.FullName, "text/plain", file.Name);
            return Content("");
        }


        public FileStreamResult GetFile(string URL)
        {
            var stream = serialazService.EntitysToDocx(new object[3]);

            return File(stream, "docx", URL+".docx");
        }

    }
}