public ActionResult AddTicketForSpecifiedShow(Ticket ticket) { if (ModelState.IsValid) { Show show = showDB.Shows.Find(ticket.ShowId); var tickets = from t in db.Tickets select t; if (tickets.Count(s => s.Row == ticket.Row && s.SeatNumber == ticket.SeatNumber) == 0) { db.Tickets.Add(ticket); db.SaveChanges(); //actualizare bilete disponibile show.AvailableTickets = show.AvailableTickets - 1; showDB.Entry(show).State = EntityState.Modified; showDB.SaveChanges(); return(RedirectToAction("EmployeeAfterLogin", "User")); } else { ViewBag.AvailableTickets = "Number of Available Tickets: " + show.AvailableTickets; ViewBag.BiletExistent = "Loc Ocupat!"; return(View(ticket)); } } return(View(ticket)); }
public async Task <IActionResult> PutPlatform(int id, Platform platform) { if (id != platform.Id) { return(BadRequest()); } _context.Entry(platform).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlatformExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutShow(int id, Show show) { if (id != show.Id) { return(BadRequest()); } _context.Entry(show).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShowExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(Show show) { if (ModelState.IsValid) { db.Entry(show).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(show)); }
public ActionResult Edit([Bind(Include = "ID,Title,premiereDate,Director,Distributiob,TicketsNumber")] Shows shows) { if (ModelState.IsValid) { db.Entry(shows).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shows)); }
public ActionResult Edit([Bind(Include = "ID,Title,ReleaseDate,Directors,Cast,Tickets")] Show show) { if (ModelState.IsValid && User.Identity.IsAuthenticated && User.IsInRole("Admin")) { db.Entry(show).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "Account")); } //return View(show); }