public async Task <ActionResult <Multiplex> > PutMultiplex(int id, Multiplex multiplex) { if (id != multiplex.MulId) { return(BadRequest()); } try { var movid = await _multiplexService.PutMultiplex(id, multiplex); } catch (DbUpdateConcurrencyException) { if (!MultiplexExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void GetMultiplexesCompleted(object sender, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) { Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message)); } else { var items = Multiplex.ParseMultiplexCollection(e.Result); PopulateMultiplexes(items); _dataService.SaveMultiplexes(items); _appSettings.DateLastUpdated = DateTime.Now; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { UpdateProgressBar(false); } }
/// <summary> /// Adds multiplex /// </summary> /// <param name="multiplex">multiplex</param> /// <returns></returns> public async Task <Multiplex> AddMultiplex(Multiplex multiplex) { await movieContext.Multiplexes.AddAsync(multiplex); await movieContext.SaveChangesAsync(); return(multiplex); }
public ActionResult Delete(int id, Multiplex m1) { var author = context.Multiplexes.Where(x => x.MultiplexId == id).SingleOrDefault(); context.Multiplexes.Remove(author); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Multiplex multiplex = db.Multiplices.Find(id); db.Multiplices.Remove(multiplex); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(int id, Multiplex m1) { Multiplex multiplex = context.Multiplexes.Where(x => x.MultiplexId == id).SingleOrDefault(); multiplex.MultiplexName = m1.MultiplexName; multiplex.MultiplexDescription = m1.MultiplexDescription; context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind("MultiplexName", "MultiplexDescription")] Multiplex m1) { if (ModelState.IsValid) { context.Multiplexes.Add(m1); context.SaveChanges(); return(RedirectToAction("Index")); } return(View(m1)); }
public ActionResult Edit([Bind(Include = "Multiplex_id,Multiplex_Name,Location,Movie_id,MovieMovie_id")] Multiplex multiplex) { if (ModelState.IsValid) { db.Entry(multiplex).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MovieMovie_id = new SelectList(db.Movies, "Movie_id", "Movie_Name", multiplex.MovieMovie_id); return(View(multiplex)); }
public ActionResult Edit([Bind(Include = "TId,TName,mid,TLoc,TPrice,MDate")] Multiplex multiplex) { if (ModelState.IsValid) { db.Entry(multiplex).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.mid = new SelectList(db.Movies, "MId", "MName", multiplex.mid); return(View(multiplex)); }
public ActionResult Create([Bind(Include = "Multiplex_id,Multiplex_Name,Location,Movie_id,MovieMovie_id")] Multiplex multiplex) { if (ModelState.IsValid) { db.Multiplexes.Add(multiplex); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MovieMovie_id = new SelectList(db.Movies, "Movie_id", "Movie_Name", multiplex.MovieMovie_id); return(View(multiplex)); }
public async Task <ActionResult <Multiplex> > PostMultiplex([FromBody] Multiplex multiplex) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var movid = await _multiplexService.PostMultiplex(multiplex); return(StatusCode(StatusCodes.Status201Created)); //return Ok(multiplex); }
private static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); var configuration = builder.Build(); DbTasks.Context = new DataBaseContext(new DbContextOptionsBuilder <DataBaseContext>().UseSqlServer(configuration.GetConnectionString("DataBase")).Options); Multiplex.ParseMultiplex(); Kinogo.ParseKinogo(); Console.ReadKey(); }
// GET: Multiplexes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Multiplex multiplex = db.Multiplices.Find(id); if (multiplex == null) { return(HttpNotFound()); } return(View(multiplex)); }
// GET: Multiplexes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Multiplex multiplex = db.Multiplices.Find(id); if (multiplex == null) { return(HttpNotFound()); } ViewBag.mid = new SelectList(db.Movies, "MId", "MName", multiplex.mid); return(View(multiplex)); }
/// <summary> /// Adds multiplex /// </summary> /// <param name="multiplexDto">multiplex object</param> /// <returns></returns> public async Task <MultiplexDTO> AddMultiplex(MultiplexDTO multiplexDto) { // Check if Same has been already added into DB var result = await this.GetMultiplexesByCity(multiplexDto.CityId); if (result.Any(a => a.MultiplexName == multiplexDto.MultiplexName)) { throw new CustomException($"Multilex with the name {multiplexDto.MultiplexName} already added."); } Multiplex multiplex = new Multiplex { MultiplexName = multiplexDto.MultiplexName, CityId = multiplexDto.CityId }; var multiplexAdded = await _movieRepository.AddMultiplex(multiplex); multiplexDto.Id = multiplexAdded.Id; return(multiplexDto); }
public ActionResult Edit(int id) { Multiplex multiplex = context.Multiplexes.Where(x => x.MultiplexId == id).SingleOrDefault(); return(View(multiplex)); }
public async Task <int> DeleteMultiplex(Multiplex multiplex) { _movieContext.Multiplexes.Remove(multiplex); return(await _movieContext.SaveChangesAsync()); }
public ActionResult Delete(int id) { Multiplex multiplex = context.Multiplexes.Find(id); return(View(multiplex)); }
public int Compute(Multiplex m) { return(m.TotalSeatingCapacity * 10); }
public async Task <int> PutMultiplex(int id, Multiplex multiplex) { _movieContext.Entry(multiplex).State = EntityState.Modified; return(await _movieContext.SaveChangesAsync()); }
public ViewResult Details(int id) { Multiplex multiplex = context.Multiplexes.Where(x => x.MultiplexId == id).SingleOrDefault(); return(View(multiplex)); }
public int Compute(Multiplex m) { return(m.NumberOfScreens * 80 + m.TotalSeatingCapacity * 2); }
public ActionResult Create(Multiplex m1) { context.Multiplexes.Add(m1); context.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <int> PostMultiplex(Multiplex multiplex) { _movieContext.Multiplexes.Add(multiplex); return(await _movieContext.SaveChangesAsync()); }