public ActionResult EditTheater(int id) { _theaterServices = new TheaterServices(); var model = _theaterServices.GetTheaterById(id); return(View(model)); }
public ActionResult AddTheater(TheaterModel model) { _theaterServices = new TheaterServices(); _theaterServices.InsertTheater(model); return(RedirectToAction("ListTheater")); }
public ActionResult ListTheaterForUser() { _theaterServices = new TheaterServices(); var model = _theaterServices.GetTheaterList(); return(View(model)); }
protected void btnSearch_Click(object sender, EventArgs e) { string city = Session["City"].ToString(); TheaterServices showTheaters = new TheaterServices(); GridViewTheaterList.DataSource = showTheaters.GetTheaters(city); GridViewTheaterList.DataBind(); }
// [Guid("4531D5B6-268C-4AB3-81EB-57D0845E21DF")] protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (this.LoadData != null) { var ex = new EventArgs(); LoadData(ex); } Label1.Text = "it works, yeah!!!!"; string theat = Session["TheaterID"].ToString(); Guid theaterId = new Guid(); theaterId = Guid.Parse(theat); TheaterServices showTheater = new TheaterServices(); TheaterModelDTO currentTheater = new TheaterModelDTO(); currentTheater = showTheater.GetTheater(theaterId); lblName.Text = currentTheater.Name; AddressServices showAddress = new AddressServices(); AddressModelDTO currentAddress = new AddressModelDTO(); currentAddress = showAddress.GetAddress(theaterId); lblAddressLine1.Text = currentAddress.AddressLine1; lblCity.Text = currentAddress.City; lblCountry.Text = currentAddress.Country; lblEmail.Text = currentAddress.Email; lblPhone.Text = currentAddress.Phone; lblPostalCode.Text = currentAddress.PostalCode; lblProvince.Text = currentAddress.Province; PerformanceServices showAllPerformances = new PerformanceServices(); GridViewPerformance.DataSource = showAllPerformances.GetPerformances(theaterId); GridViewPerformance.DataBind(); } }
public void LoadTheaters(String city) { //Method that extracts data to populate the table ITheater theaterServices = new TheaterServices(); IList <TheaterModelDTO> listOfTheaters = theaterServices.GetTheaters(city); //Transfer to Model TheaterSearchView.Model.ListOfTheaters = new List <TheaterLine>(); foreach (var item in listOfTheaters) { TheaterLine row = new TheaterLine(); row.TheaterID = item.TheaterID.ToString(); row.TheaterName = item.Name; TheaterSearchView.Model.ListOfTheaters.Add(row); } }
//Method that extracts all data to populate the Labels and the table Performance private void LoadData(Guid theaterId) { //Data extraction from database IPerformance performanceServices = new PerformanceServices(); IList <PerformanceModelDTO> ListOfPerformances = performanceServices.GetPerformances(theaterId); ITheater showTheater = new TheaterServices(); String currentTheater = showTheater.GetTheater(theaterId); IAddress showAddress = new AddressServices(); AddressModelDTO currentAddress = showAddress.GetAddress(theaterId); //Data transfer to Theater Model Myview.Model.ListOfPerformances = new List <PerformanceLine>(); foreach (var item in ListOfPerformances) { PerformanceLine row = new PerformanceLine(); row.PerformanceID = item.PerformanceID.ToString(); row.Title = item.Title; row.Date = item.Date; row.StartingTime = item.StartingTime; row.RoomNumber = item.RoomNumber.ToString(); row.Duration = item.Duration; row.Price = item.Price.ToString(); Myview.Model.ListOfPerformances.Add(row); } Myview.Model.TheaterName = currentTheater; Myview.Model.AddressLine1 = currentAddress.AddressLine1; Myview.Model.City = currentAddress.City; Myview.Model.Country = currentAddress.Country; Myview.Model.Province = currentAddress.Province; Myview.Model.PostalCode = currentAddress.PostalCode; Myview.Model.Phone = currentAddress.Phone; Myview.Model.Email = currentAddress.Email; }
public ActionResult DeleteTheater(int id) { _theaterServices = new TheaterServices(); _theaterServices.DeleteTheater(id); return(RedirectToAction("ListTheater")); }
public ActionResult EditTheater(TheaterModel model) { _theaterServices = new TheaterServices(); _theaterServices.UpdateTheater(model); return(RedirectToAction("ListTheater")); }