public ActionResult Create(FormCollection collection) { if (Session["USER_ID"] == null) { return(RedirectToAction("Login", "USER")); } try { // TODO: Add insert logic here Model1.Update("INSERT INTO [TICKET] (EVENT_ID, TICKET_DATE, SELLER_ID, TICKET_FILE_LOCATION, TICKET_PRICE, TICKET_SOLD, TICKET_ACTIVE) VALUES ('" + Session["EVENT_ID"].ToString() + "', 'empty', '" + Session["USER_ID"].ToString() + "', 'empty', '" + collection["TICKET_PRICE"] + "', 'NO', 'YES')"); return(RedirectToAction("View", "EVENT", new { id = Convert.ToInt32(Session["EVENT_ID"]) })); } catch { return(RedirectToAction("Index", "USER")); } }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here try { _ = Model1.Update("INSERT INTO [USER] (USER_FNAME, USER_LNAME, USER_EMAIL, USER_PASSWORD, USER_CAN_SELL) VALUES ('" + collection["USER_FNAME"] + "', '" + collection["USER_LNAME"] + "', '" + collection["USER_EMAIL"] + "', '" + collection["USER_PASSWORD"] + "', 'YES')"); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } return(RedirectToAction("Login", "USER")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { if (Session["USER_ID"] == null) { return(RedirectToAction("Login", "USER")); } try { try { string desc; if (collection["EVENT_DESCRIPTION"] == null) { desc = "empty"; } else { desc = collection["EVENT_DESCRIPTION"]; } _ = Model1.Update("INSERT INTO [EVENT] (EVENT_NAME, EVENT_DATE, EVENT_TIME, EVENT_VENUE, EVENT_ADDRESS, EVENT_CITY, EVENT_STATE, EVENT_ZIP, EVENT_COUNTRY, EVENT_DESCRIPTION, CATEGORY_ID, EVENT_ICON_LOCATION) VALUES ('" + collection["EVENT_NAME"] + "', '" + collection["EVENT_DATE"] + "', '" + collection["EVENT_TIME"] + "', '" + collection["EVENT_VENUE"] + "', '" + collection["EVENT_ADDRESS"] + "', '" + collection["EVENT_CITY"] + "', '" + collection["EVENT_STATE"] + "', '" + collection["EVENT_ZIP"] + "', 'US', '" + desc + "', '" + collection["CATEGORY_ID"] + "'empty'" + "')"); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } return(RedirectToAction("Index", "USER")); // change this to view details } catch { return(View()); } }