public ActionResult <DTO.Reservation> GetById(int id) { DAL.Reservation dalreservation = DAL.ReservationManager.GetReservationById(id); DTO.Reservation dtoreservation = new DTO.Reservation(); dtoreservation.ReservationId = dalreservation.ReservationId; return(dtoreservation); }
public static Int64 Erstellen(DAL.Reservation reservation) { if (reservation.Spielername == null || reservation.Spielername == "") { reservation.Spielername = "leer"; } if (reservation.Startzeit == null) { reservation.Startzeit = DateTime.MinValue; } if (reservation.Endzeit == null) { reservation.Endzeit = DateTime.MinValue; } using (var context = new DAL.Context()) { context.Reservation.Add(reservation); //TODO Check ob mit null möglich, sonst throw Ex if (reservation.Platz != null) { context.Platz.Attach(reservation.Platz); } context.SaveChanges(); return(reservation.ReservationId); } }
public static void Loeschen(DAL.Reservation reservation) { using (var context = new DAL.Context()) { context.Reservation.Attach(reservation); context.Reservation.Remove(reservation); context.SaveChanges(); } }
public static void Aktualisieren(DAL.Reservation reservation) { using (var context = new DAL.Context()) { //TODO null Checks? context.Entry(reservation).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public IActionResult Create(DTO.Reservation item) { var dalitem = new DAL.Reservation(); dalitem.MovieEventId = item.MovieEvent.MovieEventId; dalitem.SeatId = item.Seat.SeatId; dalitem.UserId = item.User.UserId; DAL.ReservationManager.AddReservation(dalitem); return(Created("http://localhost:6544/api/reservation", dalitem)); }