public ActionResult Book(Booking book)
        {
            if (bookLogic.GetBookingsBetween(book.StartDate, book.EndDate).Any(b => !b.State.Equals("canceled") && b.RealEstate.Id == book.RealEstate.Id))
            {
                return View("BookingResult", null, book.RealEstate.Name + "is already booked on the specified dates!");
            }

            bookLogic.AddBooking(book);
            book.State = "pending";

            var message = new MailMessage();
            message.To.Add(book.RealEstate.Owner.Email);
            message.Subject = "Confirm booking #" + book.Id;
            message.Body = "Booking #" + book.Id + "details for " + book.RealEstate.Name + ": \n" +
                            "\tStart date:" + book.StartDate +
                            "\n\tEnd date" + book.EndDate +
                           "\n\nFollow this link to confirm: http://www.realestatebooking.com/Booking/Confirm?id=" + book.Id +
                           "\nor this if you want to cancel the booking: http://www.realestatebooking.com/Booking/Cancel?id=" + book.Id;

            var smtp = new SmtpClient();
            smtp.Send(message);
            return View("BookingResult", null, "The booking request was successfuly completed. " +
                "\n\nCurrent booking state:" +
                "\n\tId: " + book.Id +
                "\n\tStatus: " + book.State);
        }
 public void AddBooking(Booking book)
 {
     _bookingDal.Add(book);
 }
 public void Update(Booking obj)
 {
     throw new System.NotImplementedException();
 }
 public void Add(Booking objToAdd)
 {
     objToAdd.Id = _id++;
     _bookings.Add(objToAdd);
 }