SHARE
TWEET

Untitled

a guest Jun 26th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class AppointmentBookingViewModel
  2.     {
  3.         [Display (Name ="Select Staff")]
  4.         public int StaffId { get; set; }
  5.         public IEnumerable<Staff> Staffs { get; set; }
  6.  
  7.         [Display(Name = "Select Service")]
  8.         public int ServiceId { get; set; }
  9.         public IEnumerable<Service> Services { get; set; }
  10.  
  11.         [Display(Name = "Select Slot")]
  12.         public int BookingSlotId { get; set; }
  13.         public IEnumerable<BookingSlot> BookingSlots { get; set; }
  14.  
  15.     }
  16.      
  17. public class AppointmentBookingController : Controller
  18.     {
  19.         private readonly SalonContext _context;
  20.  
  21.         private AppointmentBookingViewModel _appointmentBookingViewModel = new AppointmentBookingViewModel();
  22.  
  23.         public AppointmentBookingController(SalonContext context)
  24.         {
  25.  
  26.             _context = context;
  27.             ConfigureViewModel(_appointmentBookingViewModel);
  28.  
  29.         }
  30.  
  31.         public void ConfigureViewModel(AppointmentBookingViewModel appointmentBookingViewModel)
  32.         {
  33.             appointmentBookingViewModel.Staffs = _context.Staffs;
  34.             appointmentBookingViewModel.Services = _context.Services;
  35.             appointmentBookingViewModel.BookingSlots = _context.BookingSlots;
  36.         }
  37.  
  38.  
  39.         // GET: AppointmentBooking
  40.         public ActionResult Index()
  41.         {
  42.  
  43.             return View(_appointmentBookingViewModel);
  44.         }
  45. }
  46.      
  47. @model HairStudio.Services.ViewModels.AppointmentBooking.AppointmentBookingViewModel
  48. @{
  49.     ViewData["Title"] = "Create";
  50.     Layout = "~/Views/Shared/_Layout.cshtml";
  51. }
  52.  
  53. <div class="row">
  54.     <div class="col-12">
  55.         <form asp-action="Create">
  56.             <div class="form-group">
  57.                 <label asp-for="ServiceId" class="control-label"></label>
  58.                 <select asp-for="ServiceId" class="form-control"></select>
  59.             </div>
  60.  
  61.             <div class="form-group">
  62.                 <input type="submit" value="Create" class="btn btn-primary" />
  63.             </div>
  64.         </form>
  65.     </div>
  66. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top