public ActionResult Delete(int id, Models.Seat seat) { var seatDelete = seatRepository.FindById(id); seatDelete.InjectFrom(seat); seatService.DeleteSeat(seatDelete); TempData["message"] = string.Format("{0} has been saved", seat.SeatNo); return(RedirectToAction("Index")); }
public static Seat ToSeatContract(Models.Seat from) { return(new Seat { AreaId = from.AreaId, Id = from.Id, Number = from.Column, Row = from.Row }); }
// GET: Seat/Edit/5 public ActionResult Edit(int id) { var seat = seatRepository.GetById(id); if (seat == null) { return(HttpNotFound()); } var seatId = new Models.Seat(); seatId.InjectFrom(seat); return(View(seatId)); }
public ActionResult Edit(Models.Seat seat) { if (ModelState.IsValid) { var seatEdit = new Domain.Seat(); seatEdit.InjectFrom(seat); seatService.UpdateSeat(seatEdit); TempData["message"] = string.Format("{0} has been saved", seat.SeatNo); } else { return(View(seat)); } return(RedirectToAction("Index")); }
public List <Models.Seat> FindSeatsByHallId(int hId) { using (PersonServiceClient proxy = new PersonServiceClient()) { List <Models.Seat> seats = new List <Models.Seat>(); List <WebService.Seat> s = proxy.FindSeatsByHallId(hId); foreach (WebService.Seat tempS in s) { Models.Seat seat = new Models.Seat(); seat.SeatId = tempS.SeatId; seat.Row = tempS.Row; seat.ResId = tempS.ResId; seat.Number = tempS.Number; seat.HallId = tempS.HallId; seat.booked = tempS.Booked; seats.Add(seat); } return(seats); } }
public ActionResult Create(Models.Seat model) { if (ModelState.IsValid) { if (!seatService.ExistsSeat(model.SeatNo)) { var dbModel = new Domain.Seat(); dbModel.InjectFrom(model); //filmRepository.Add(dbModel); seatService.AddSeat(dbModel); TempData["message"] = string.Format("{0} has been saved", model.SeatNo); } else { ModelState.AddModelError("SeatNo", "Can't add a seat number that is already in the database!"); return(View(model)); } return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Create() { var model = new Models.Seat(); return(View(model)); }
// GET: Movie/Details/5 public ActionResult Details(int id) { Models.Seat seat = context.Seats.SqlQuery("Select * FROM Seats where MovieId=@p0", id).SingleOrDefault(); return(View(seat)); }