public ActionResult import(FormCollection fc, HttpPostedFileBase file) { if (file == null) { GroupBll bll = new GroupBll(); var list = bll.GetMatch("1"); StringBuilder sbt = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (list[i].Match_id == fc["match"]) { sbt.AppendFormat("<option value='{0}' selected>{1}</option>", list[i].Match_id, list[i].Match_name); } else { sbt.AppendFormat("<option value='{0}'>{1}</option>", list[i].Match_id, list[i].Match_name); } } ViewBag.match = sbt.ToString(); ViewBag.flag = "-1"; return(View()); } else { string filename = string.Format("{0}{1}", Guid.NewGuid().ToString(), System.IO.Path.GetExtension(file.FileName)); file.SaveAs(System.IO.Path.Combine(Server.MapPath("~/upload/file"), filename)); return(RedirectToAction("confirm", new { matchid = fc["match"], fid = filename })); } }
public ActionResult import() { GroupBll bll = new GroupBll(); var list = bll.GetMatch("1"); StringBuilder sbt = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (i == 0) { sbt.AppendFormat("<option value='{0}' selected>{1}</option>", list[i].Match_id, list[i].Match_name); } else { sbt.AppendFormat("<option value='{0}'>{1}</option>", list[i].Match_id, list[i].Match_name); } } ViewBag.match = sbt.ToString(); ViewBag.flag = "0"; return(View()); }