public async Task<ActionResult> Create(ReservationViewModel model)
{
if (ModelState.IsValid)
{
var reservation = new Reservation
{
Message = model.Message,
PhoneNumber = model.UserPhoneNumber,
Name = model.UserName,
VactionPropertyId = model.VacationPropertyId,
Status = ReservationStatus.Pending,
CreatedAt = DateTime.Now
};
await _reservationsRepository.CreateAsync(reservation);
reservation.VacationProperty = new VacationProperty {Description = model.VacationPropertyDescription};
await _notifier.SendNotificationAsync(reservation);
return RedirectToAction("Index", "VacationProperties");
}
return View(model);
}