public string AskForAjax1(請假細項 k, HttpPostedFileBase upPhoto) // { string filePath = ""; if (upPhoto != null) { filePath = "/images/" + DateTime.Now.ToString("yyyyMMddhhmmss") + upPhoto.FileName; upPhoto.SaveAs(Server.MapPath("~") + filePath); } k.圖片 = filePath; db.請假細項.Add(k); db.SaveChanges(); return("ok"); }
public JsonResult UpdateDataAjax(請假細項 mb) // { db.Entry <請假細項>(mb).State = EntityState.Modified; //why db.SaveChanges(); return(Json(mb, JsonRequestBehavior.AllowGet)); }