public async Task <SeatDomainModel> AddSeat(SeatDomainModel newSeat) { Seat seatToCreate = new Seat() { AuditoriumId = newSeat.AuditoriumId, Number = newSeat.Number, Row = newSeat.Row }; var data = _seatsRepository.Insert(seatToCreate); if (data == null) { return(null); } _seatsRepository.Save(); SeatDomainModel domainModel = new SeatDomainModel() { Id = data.Id, AuditoriumId = data.AuditoriumId, Number = data.Number, Row = data.Row }; return(domainModel); }
public ActionResult Create([Bind(Include = "Id,IsAvailable,SeatNumber,PassengerId,BusId,Time")] Seat seat) { if (ModelState.IsValid) { repository.Insert(seat); repository.Save(); return(RedirectToAction("Index")); } ViewBag.BusId = new SelectList(repository_b.All, "BusId", "NrReg", seat.BusId); ViewBag.PassengerId = new SelectList(repository_p.All, "Id", "Name", seat.PassengerId); return(View(seat)); }