public JsonResult UpdateFile() { var status = false; HttpPostedFileBase myFile = null; if (Request.Files.Count > 0) myFile = Request.Files[0]; if (myFile != null && myFile.ContentLength != 0) { string pathForSaving = Server.MapPath("~/ImageUploads"); if (SharedFunction.CreateFolderIfNeeded(pathForSaving)) { try { string fileName = DateTime.Now.ToString("MMddyyyyHHmmss") + Path.GetExtension(myFile.FileName); myFile.SaveAs(Path.Combine(pathForSaving, fileName)); string path = "~/ImageUploads/" + fileName; var conventionManager = new DataAccess.ConventionManager(); status = conventionManager.Update(Request.Form["name"].ToString(), Convert.ToDateTime(Request.Form["startDate"]), Convert.ToDateTime(Request.Form["endDate"]), Request.Form["description"].ToString(), Convert.ToInt32(Request.Form["userId"]), Convert.ToInt32(Request.Form["conventionID"]), null, path, myFile.FileName); } catch (Exception ex) { } } } return Json(status); }
public JsonResult Update(string name, DateTime startDate, DateTime endDate, string description, int userID, int conventionID, string city) { if (!IsAdmin) { return Json(false); } var conventionManager = new DataAccess.ConventionManager(); return Json(conventionManager.Update(name, startDate, endDate, description, userID, conventionID, city)); }