using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApplication1.Models;

namespace WebApplication1.Controllers
{
    public class DefaultController : Controller
    {
        // GET: Default
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(Person p)
        {

            foreach (var file in p.Files)
            {
                if (file.ContentLength > 0)
                {
                    var Imag = file.FileName;
                    file.SaveAs(Server.MapPath("/Image/" + Imag));
                }
            }


            return RedirectToAction("Index");
        }
        //public ActionResult Index(Person person)
        //{
        //    if (person.file.ContentLength > 0)
        //    {
        //        var Imag = person.file.FileName;
        //        person.file.SaveAs(Server.MapPath("/Image/"+Imag));
        //    }
        //    return RedirectToAction("Index");
        //}

    }
}