public Theaters Update(Theaters updatedTheater) { var entity = db.Theaters.Attach(updatedTheater); entity.State = EntityState.Modified; return(updatedTheater); }
public void ShowTheaters() { Console.Clear(); int choice = -1; while (choice == -1) { System.Console.WriteLine("Pick a theater"); var i = 1; Theaters.ForEach(theater => { System.Console.WriteLine($@" ---------------------------- |{i}. {theater.Name} | {theater.RoomNumber} ---------------------------- "); i++; }); System.Console.WriteLine("Which theater do you want to pick?"); var userInput = Console.ReadLine(); int.TryParse(userInput, out choice); } activeTheater = Theaters[choice - 1]; System.Console.WriteLine($"You have selected {activeTheater.Name}"); }
// POST api/<controller> public void Post() { Movies movie = new Movies(); movie.name = HttpContext.Current.Request.Params["name"]; movie.date = Convert.ToDateTime(HttpContext.Current.Request.Params["date"]); movie.year = HttpContext.Current.Request.Params["year"]; movie.genre = HttpContext.Current.Request.Params["genre"]; movie.length = Convert.ToInt32(HttpContext.Current.Request.Params["length"]); movie.seats = Convert.ToInt32(HttpContext.Current.Request.Params["seats"]); HttpPostedFile file = HttpContext.Current.Request.Files["img"]; //string ext = Path.GetExtension(file.FileName); file.SaveAs(HttpContext.Current.Server.MapPath("~") + "/images/" + file.FileName); movie.movie_img_url = "/images/" + file.FileName; Theaters theater = new Theaters(); theater.hall_num = Convert.ToInt32(HttpContext.Current.Request.Params["hall_num"]); theater.avail_seats_arr = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; movie.Theaters.Add(theater); CinemaDB db = new CinemaDB(); db.Movies.Add(movie); db.SaveChanges(); }
public IHttpActionResult PutTheaters(int id, Theaters theaters) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != theaters.TheaterId) { return(BadRequest()); } db.Entry(theaters).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TheatersExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Inserttheaters([FromBody] Theaters theater) { //elasticClient.DeleteIndex("theater_ind"); if (!elasticClient.Indices.Exists("theater_ind").Exists) { var indexSettings = new IndexSettings(); indexSettings.NumberOfReplicas = 1; indexSettings.NumberOfShards = 3; var createIndexDescriptor = new CreateIndexDescriptor("theater_ind") .Mappings(ms => ms .Map <Theaters>(m => m.AutoMap()) ) .InitializeUsing(new IndexState() { Settings = indexSettings }) .Aliases(a => a.Alias("theaterAlias")); var response = elasticClient.Indices.Create(createIndexDescriptor); } //Insert Data elasticClient.Index <Theaters>(theater, idx => idx.Index("theater_ind")); }
public async Task <IActionResult> Edit(int id, [Bind("ThId,ThName,ThCt,ThWebsite,ThInfo")] Theaters theaters) { if (id != theaters.ThId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(theaters); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TheatersExists(theaters.ThId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ThCt"] = new SelectList(_context.Cities, "CtId", "CtName", theaters.ThCt); return(View(theaters)); }
public TheaterForm(Theaters theater) { InitializeComponent(); Theater = theater; this.Cursor = Cursors.WaitCursor; var webClient = new WebClient(); var webClient2 = new WebClient(); string url = "http://94.230.164.34:8080/api/PictureTheater?id=" + Theater.Id_theater; webClient.DownloadDataCompleted += DownloadDataCompleted; webClient.DownloadDataTaskAsync(url); theater_name_lbl.Text = Theater.Theater_name; site_lbl.Text = Theater.Theater_site; address_lbl.Text += Theater.Theater_address; theater_name_lbl.Left = 750 - theater_name_lbl.Width / 2; site_lbl.Left = 750 - site_lbl.Width / 2; address_lbl.Left = 750 - address_lbl.Width / 2; if (Theater.Theater_description != null) { web.DocumentText = Theater.Theater_description; } else { web.DocumentText = Description.empty_description; } }
private void data_theaters_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { Theaters theater = new Theaters(); theater = theaters[e.RowIndex]; TheaterForm theater_form = new TheaterForm(theater); theater_form.Show(); }
public void CreateTheater(string name, int roomNumber, int capacity) { Theaters.Add(new Theater() { Name = name, RoomNumber = roomNumber, Capacity = capacity }); }
public IHttpActionResult GetTheaters(int id) { Theaters theaters = db.Theaters.Find(id); if (theaters == null) { return(NotFound()); } return(Ok(theaters)); }
public async Task <IActionResult> Create([Bind("ThId,ThName,ThCt,ThWebsite,ThInfo")] Theaters theaters) { if (ModelState.IsValid) { _context.Add(theaters); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ThCt"] = new SelectList(_context.Cities, "CtId", "CtName", theaters.ThCt); return(View(theaters)); }
public void Put(int movieNumber, string newSeatsArr) { CinemaDB db = new CinemaDB(); Theaters theater = db.Theaters.SingleOrDefault(x => x.movie_number == movieNumber); if (theater != null) { theater.avail_seats_arr = newSeatsArr; db.SaveChanges(); } }
public void Post(int movieNum, [FromBody] int hallNum) { Theaters theater = new Theaters(); theater.movie_number = movieNum; theater.hall_num = hallNum; theater.avail_seats_arr = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; CinemaDB db = new CinemaDB(); db.Theaters.Add(theater); db.SaveChanges(); }
public Theaters Update(Theaters updatedTheater) { var theater = theaters.SingleOrDefault(t => t.Id == updatedTheater.Id); if (theater != null) { theater.Name = updatedTheater.Name; theater.Adress = updatedTheater.Adress; theater.Performance = updatedTheater.Performance; } return(theater); }
public IHttpActionResult PostTheaters(Theaters theaters) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Theaters.Add(theaters); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = theaters.TheaterId }, theaters)); }
public IActionResult Update(string id, Theaters theaterIn) { var theater = _service.Get(id); if (theater == null) { return(NotFound()); } _service.Update(id, theaterIn); return(NoContent()); }
public IHttpActionResult DeleteTheaters(int id) { Theaters theaters = db.Theaters.Find(id); if (theaters == null) { return(NotFound()); } db.Theaters.Remove(theaters); db.SaveChanges(); return(Ok(theaters)); }
public IActionResult OnGet(int?theaterID) { Performances = htmlHelper.GetEnumSelectList <PerformanceType>(); if (theaterID.HasValue) { Theaters = theaterData.GetById(theaterID.Value); } else { Theaters = new Theaters(); } if (Theaters == null) { return(RedirectToPage("./NotFound")); } return(Page()); }
public void Update(string id, Theaters theaterIn) => _theaters.ReplaceOne(theater => theater.Id == id, theaterIn);
public Theaters Create(Theaters theater) { _theaters.InsertOne(theater); return(theater); }
public ActionResult <Theaters> Create(Theaters theater) { _service.Create(theater); return(CreatedAtRoute("GetTheater", new { id = theater.Id.ToString() }, theater)); }
public void Put(int id, [FromBody] Theaters theater) { elasticClient.UpdateAsync <Theaters>(id, u => u.Doc(theater)); }
public void Remove(Theaters theaterIn) => _theaters.DeleteOne(theater => theater.Id == theaterIn.Id);
public Theaters Add(Theaters newTheater) { theaters.Add(newTheater); newTheater.Id = theaters.Max(t => t.Id) + 1; return(newTheater); }
public Theaters Add(Theaters newTheater) { db.Add(newTheater); return(newTheater); }
public TheaterSettings GetTheater(TheaterType th) { return(Theaters.FirstOrDefault(t => t.Type.Equals(th))); }
public bool SetActiveTheater(TheaterType theater) { ActiveTheater = Theaters.First(t => t.Type == theater); return(ActiveTheater != null); }