public ActionResult Create(HttpPostedFileBase f) { fx_doc doc = new fx_doc(); try { if (f == null) { throw new Exception("Файл не задан"); } DB.createNew(f.FileName, User.Identity.Name); using (FileStream fs = System.IO.File.Create((string)System.Web.HttpContext.Current.Application["docs"] + f.FileName)) { f.InputStream.CopyTo(fs); fs.Close(); } return(RedirectToAction("Index")); } catch (Exception e) { ModelState.AddModelError("", e.Message); } return(View(doc)); }
public ActionResult Create() { var doc = new fx_doc(); return(View(doc)); }