Пример #1
0
 public ActionResult Upload(ModelFile model, HttpPostedFileBase file) //
 {
     if (ModelState.IsValid)
     {
         if (file != null)
         {
             var contents = new byte[file.ContentLength];
             file.InputStream.Read(contents, 0, file.ContentLength);
             var filePath = ModelUtility.GetModel(model, "ifc");
             System.IO.File.WriteAllBytes(filePath, contents);
             Task.Run(() => ModelUtility.ConvertModel(filePath));
             return(Json("OK"));
         }
         //TempData["message"] = string.Format("{0} has been saved", product.Name);
         return(Json("no file"));
     }
     else
     {
         // there is something wrong with the data values
         return(Json("输入数据有误"));
     }
 }