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)); }
public bool updateSection() { string name = Request.Form["name"]; string capacityS = Request.Form["capacity"]; string categoryIdS = Request.Form["categoryId"]; string sectionIdS = Request.Form["sectionId"]; int capacity, categoryId, sectionId; bool isNumeric1 = int.TryParse(capacityS, out capacity); bool isNumeric2 = int.TryParse(categoryIdS, out categoryId); bool isNumeric3 = int.TryParse(sectionIdS, out sectionId); if (!isNumeric1 || !isNumeric2 || !isNumeric3) { return(false); } return(EditStadiumModel.updateSection(name, capacity, categoryId, sectionId)); }