public bool updateEvent() { string fileName = "NULL"; string updatePic = Request.Form["updatePic"]; if (updatePic == "true") { try { for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; //int fileSize = file.ContentLength; string extension = Path.GetExtension(file.FileName); fileName = KardoStaticMethods.createKardoUID() + extension; //string mimeType = file.ContentType; System.IO.Stream fileContent = file.InputStream; file.SaveAs(Server.MapPath("~/Content/kardoPasso/img/uploads/") + fileName); } } catch { return(false); } } string hTeamIdS = Request.Form["hTeamId"]; string oTeamIdS = Request.Form["oTeamId"]; string stadiumIdS = Request.Form["stadiumId"]; string eventDate = Request.Form["eventDate"]; string description = Request.Form["description"]; string priceS = Request.Form["price"]; string eventIdS = Request.Form["eventId"]; int hTeamId, oTeamId, stadiumId, eventId; bool isNumeric1 = int.TryParse(hTeamIdS, out hTeamId); bool isNumeric2 = int.TryParse(oTeamIdS, out oTeamId); bool isNumeric3 = int.TryParse(stadiumIdS, out stadiumId); bool isNumeric5 = int.TryParse(eventIdS, out eventId); float price; bool isNumeric4 = float.TryParse(priceS, out price); if (!isNumeric1 || !isNumeric2 || !isNumeric3 || !isNumeric4 || !isNumeric5) { return(false); } return(PagePanelModel.updateEvent(hTeamId, oTeamId, stadiumId, eventDate, description, price, fileName, eventId));; }
public bool updateStadium() { string fileName = "NULL"; string updatePic = Request.Form["updatePic"]; if (updatePic == "true") { try { for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; string extension = Path.GetExtension(file.FileName); fileName = KardoStaticMethods.createKardoUID() + extension; System.IO.Stream fileContent = file.InputStream; file.SaveAs(Server.MapPath("~/Content/kardoPasso/img/uploads/") + fileName); } } catch { return(false); } } string name = Request.Form["name"]; string sportTypeIdStr = Request.Form["sportTypeId"]; string country = Request.Form["country"]; string state = Request.Form["state"]; string city = Request.Form["city"]; string location = Request.Form["location"]; string streetAdd = Request.Form["streetAdd"]; string stadiumIdS = Request.Form["stadiumId"]; int sportTypeId, stadiumId; bool isNumeric1 = int.TryParse(sportTypeIdStr, out sportTypeId); bool isNumeric2 = int.TryParse(stadiumIdS, out stadiumId); if (!isNumeric1 || !isNumeric2) { return(false); } return(EditStadiumModel.updateStadium(name, fileName, location, streetAdd, state, city, country, sportTypeId, stadiumId)); }