public TheaterModelDTO GetTheater(Guid theaterId) { Theater spesificTheater = new Theater(); using (var context = new CinemaEntities()) { spesificTheater = (from theater in context.Theaters where theater.TheaterID == theaterId select theater).FirstOrDefault(); } TheaterModelDTO theaterToReturn = new TheaterModelDTO(); theaterToReturn.TheaterID = spesificTheater.TheaterID; theaterToReturn.Name = spesificTheater.Name; return theaterToReturn; }
public IList<TheaterModelDTO> GetTheaters(string city) { IList<TheaterModelDTO> theaterList = new List<TheaterModelDTO>(); IList<Addresses.AddressModelDTO> addressList = new List<Addresses.AddressModelDTO>(); using (var context = new CinemaEntities()) { var adddresses = (from address in context.Addresses where address.City == city select address).ToList(); if (adddresses.Count > 0) { foreach (var address in adddresses) { var addressRow = new Addresses.AddressModelDTO(); addressRow.AddressID = address.AddressID; addressRow.ObjectID = address.ObjectID; addressList.Add(addressRow); Guid currentTheater = addressRow.ObjectID; if (addressList != null) { using (var context1 = new CinemaEntities()) { var theaters = (from theater in context1.Theaters where theater.TheaterID == currentTheater select theater).ToList(); if (theaters.Count>0) { foreach (var theater in theaters) { var theaterRow = new TheaterModelDTO(); theaterRow.Name = theater.Name; theaterRow.TheaterID = theater.TheaterID; theaterList.Add(theaterRow); } } } } } } } return theaterList; }
public IList <TheaterModelDTO> GetTheaters(string city) { IList <TheaterModelDTO> theaterList = new List <TheaterModelDTO>(); IList <Addresses.AddressModelDTO> addressList = new List <Addresses.AddressModelDTO>(); using (var context = new CinemaEntities()) { var adddresses = (from address in context.Addresses where address.City == city select address).ToList(); if (adddresses.Count > 0) { foreach (var address in adddresses) { var addressRow = new Addresses.AddressModelDTO(); addressRow.AddressID = address.AddressID; addressRow.ObjectID = address.ObjectID; addressList.Add(addressRow); Guid currentTheater = addressRow.ObjectID; if (addressList != null) { using (var context1 = new CinemaEntities()) { var theaters = (from theater in context1.Theaters where theater.TheaterID == currentTheater select theater).ToList(); if (theaters.Count > 0) { foreach (var theater in theaters) { var theaterRow = new TheaterModelDTO(); theaterRow.Name = theater.Name; theaterRow.TheaterID = theater.TheaterID; theaterList.Add(theaterRow); } } } } } } } return(theaterList); }
// [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 TheaterModelDTO GetTheater(Guid theaterId) { Theater spesificTheater = new Theater(); using (var context = new CinemaEntities()) { spesificTheater = (from theater in context.Theaters where theater.TheaterID == theaterId select theater).FirstOrDefault(); } TheaterModelDTO theaterToReturn = new TheaterModelDTO(); theaterToReturn.TheaterID = spesificTheater.TheaterID; theaterToReturn.Name = spesificTheater.Name; return(theaterToReturn); }