// POST: api/LunchReservations
 public HttpResponseMessage Post(LunchReservation lunchReservation)
 {
     try
     {
         var dateWithStudentResult = _lunchReservationService.GetByDateWithStudent(lunchReservation.ReservationDate, lunchReservation.StudentId);
         if (dateWithStudentResult != null)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Kullanıcıya ait Aynı tarihli Rezervasyon bulunuyor."));
         }
         var result = _lunchReservationService.Add(lunchReservation);
         return(Request.CreateResponse(HttpStatusCode.Created, result));
     }
     catch (Exception)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Eklenemedi"));
     }
 }
Пример #2
0
 public LunchReservation Update(LunchReservation foodReservation)
 {
     return(_lunchReservationDal.Update(foodReservation));
 }
Пример #3
0
 public LunchReservation Add(LunchReservation foodReservation)
 {
     return(_lunchReservationDal.Add(foodReservation));
 }