public ActionResult Index()
 {
     ListsOfStuff list1 = new ListsOfStuff();
     list1.wrongDate = false;
     list1.wrongFile = false;
     return View(list1);
 }
        public ActionResult Index(IEnumerable<HttpPostedFileBase> fileUpload, string ArticleName, string TagList, 
            string Author, string Year, string Journal, string Publisher, string Note)
        {
            if (ArticleName == "")
            {
                ListsOfStuff list1 = new ListsOfStuff();
                return View(list1);
            }
            if ((DateTime.Now.Year <= Convert.ToInt32(Year)) || (Convert.ToInt32(Year) <= 1500))
            {
                ListsOfStuff list1 = new ListsOfStuff();
                list1.ArticleName = ArticleName;
                list1.Author = Author;
                list1.Journal = Journal;
                list1.Note = Note;
                list1.Publisher = Publisher;
                list1.TagList = TagList;
                list1.wrongDate = true;
                return View(list1);
            }
            foreach (var file in fileUpload)
            {
                string filename = "";
                if (file != null)
                {
                    string allowFormat = "pdf";
                    var fileExt = System.IO.Path.GetExtension(file.FileName).Substring(1);
                    if (fileExt != allowFormat)
                    {
                        ListsOfStuff list1 = new ListsOfStuff();
                        list1.ArticleName = ArticleName;
                        list1.Author = Author;
                        list1.Journal = Journal;
                        list1.Note = Note;
                        list1.Publisher = Publisher;
                        list1.TagList = TagList;
                        list1.Year = Year;
                        list1.wrongFile = true;
                        return View(list1);
                    }
                    //string path = AppDomain.CurrentDomain.BaseDirectory + "UploadedFiles/";
                    filename = System.IO.Path.GetFileName(file.FileName);
                    file.SaveAs(Server.MapPath("~/Files/" + filename));
                }
                List<string> list = StringToList(TagList);
                List<Tag> lT = new List<Tag>();
                for (int i = 0; i < list.Count; i++)
                {
                    Tag t = new Tag { TagName = list[i] };
                    //lT.Add(t);
                    //db.Tags.Add(t);
                    addTag(t);
                    db.SaveChanges();
                }
                for (int i = 0; i < list.Count; i++)
                {
                    foreach(var t in db.Tags.ToList())
                    {
                        if (t.TagName == list[i])
                        {
                            lT.Add(t);
                        }
                    }
                }

                string tt = Request.Form["TypeT"].ToString();
                int tg = Convert.ToInt32(Request.Form["GroupT"].ToString());

                Article a1 = new Article { title = ArticleName, Path = filename, Tags = lT, author = Author, Type = tt,  journal = Journal, note = Note, publisher = Publisher, year = Year, UserName = User.Identity.Name, GroupId = tg };
                db.Articles.Add(a1);
                CreateBibFile(a1);
                db.SaveChanges();
                UsersArticle ua = new UsersArticle { UserName = User.Identity.Name, ArticleId = a1.ArticleId};
                db.UsersArticles.Add(ua);
                db.SaveChanges();
            }

            return RedirectToAction("Finish");
        }
 public ActionResult Manage()
 {
     ListsOfStuff list = new ListsOfStuff();
     return View(list);
 }