コード例 #1
0
 public ActionResult InsertProduct(int matl, string tensanpham, double gia, HttpPostedFileBase myfile)
 {
     try
     {
         string _path = "";
         if (myfile.ContentLength > 0)
         {
             string _FileName = Path.GetFileName(myfile.FileName);
             _path = Path.Combine(Server.MapPath("~/UploadFiles"), _FileName);
             myfile.SaveAs(_path);
             SanPhamAction.addSanPham(matl, tensanpham, gia, _FileName);
         }
         return(RedirectToAction("ManageProduct", "TMDT"));
     }
     catch
     {
         return(RedirectToAction("ManageProduct", "TMDT"));
     }
 }