Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AppointmentBookingViewModel
- {
- [Display (Name ="Select Staff")]
- public int StaffId { get; set; }
- public IEnumerable<Staff> Staffs { get; set; }
- [Display(Name = "Select Service")]
- public int ServiceId { get; set; }
- public IEnumerable<Service> Services { get; set; }
- [Display(Name = "Select Slot")]
- public int BookingSlotId { get; set; }
- public IEnumerable<BookingSlot> BookingSlots { get; set; }
- }
- public class AppointmentBookingController : Controller
- {
- private readonly SalonContext _context;
- private AppointmentBookingViewModel _appointmentBookingViewModel = new AppointmentBookingViewModel();
- public AppointmentBookingController(SalonContext context)
- {
- _context = context;
- ConfigureViewModel(_appointmentBookingViewModel);
- }
- public void ConfigureViewModel(AppointmentBookingViewModel appointmentBookingViewModel)
- {
- appointmentBookingViewModel.Staffs = _context.Staffs;
- appointmentBookingViewModel.Services = _context.Services;
- appointmentBookingViewModel.BookingSlots = _context.BookingSlots;
- }
- // GET: AppointmentBooking
- public ActionResult Index()
- {
- return View(_appointmentBookingViewModel);
- }
- }
- @model HairStudio.Services.ViewModels.AppointmentBooking.AppointmentBookingViewModel
- @{
- ViewData["Title"] = "Create";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <div class="row">
- <div class="col-12">
- <form asp-action="Create">
- <div class="form-group">
- <label asp-for="ServiceId" class="control-label"></label>
- <select asp-for="ServiceId" class="form-control"></select>
- </div>
- <div class="form-group">
- <input type="submit" value="Create" class="btn btn-primary" />
- </div>
- </form>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement