public JsonResult Add(string name, DateTime startDate, DateTime endDate, string description, int userId, string city)
 {
     if (!IsAdmin) { return Json(false); }
     var conventionManager = new DataAccess.ConventionManager();
     return Json(conventionManager.Add(name, startDate, endDate, description, userId, city));
 }
 public JsonResult UploadFile()
 {
     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;
                 if (!IsAdmin) { return Json(false); }
                 var conventionManager = new DataAccess.ConventionManager();
                 status = conventionManager.Add(Request.Form["name"].ToString(), Convert.ToDateTime(Request.Form["startDate"]), Convert.ToDateTime(Request.Form["endDate"]), Request.Form["description"].ToString(), Convert.ToInt32(Request.Form["userId"]), null, path, myFile.FileName);
             }
             catch (Exception ex)
             {
                 return Json(ex.InnerException);
             }
         }
     }
     return Json(status);
 }