public string upJD(int Id) { WebApplication1.EF.product p = context.product.FirstOrDefault(a => a.ID == Id); string path = Server.MapPath("~/zl/") + p.Name; var file = Request.Files["jd"]; string date = DateTime.Now.Year + "年" + DateTime.Now.Month + "月"; file.SaveAs(path + "/" + date + ".doc"); EF.upjd u = new upjd(); u.ProductID = Id; u.upDate = DateTime.Now.ToString(); context.upjd.Add(u); context.SaveChanges(); return("success"); }
public string upJD(int Id, string lb) { product p = context.product.FirstOrDefault(a => a.ID == Id); string path = Server.MapPath("~/zl/") + p.Name; var file = Request.Files["jd"]; if (lb == "进度") { string date = DateTime.Now.Year + "年" + DateTime.Now.Month + "月"; file.SaveAs(path + "/" + date + "." + file.FileName.Split('.')[file.FileName.Split('.').Count() - 1]); } else { file.SaveAs(path + "/" + lb + "." + file.FileName.Split('.')[file.FileName.Split('.').Count() - 1]); } upjd u = new upjd(); u.ProductID = Id; u.upDate = DateTime.Now.ToString(); context.upjd.Add(u); context.SaveChanges(); return("success"); }