示例#1
0
        public ActionResult Upload(HttpPostedFileBase file)
        {
            if (file != null && file.ContentLength > 0)
            {
                if (!Path.GetExtension(file.FileName).ToLower().Equals(".csv"))
                {
                    throw new NotSupportedException("Upload of files, other then CSV, is not supported.");
                }

                List <Person> persons = PersonsFactory.Create(file.InputStream);
                persons.ForEach(x => this.m_dataPrivider.Add(x));
                this.m_dataPrivider.Save();
            }
            return(View(this.m_dataPrivider.GetUsers()));
        }
示例#2
0
 public Engine()
 {
     factory = new PersonsFactory();
     people  = new List <Person>();
 }