Exemplo n.º 1
0
        public ActionResult MakeAppointment(int id)
        {
            var builder   = new MakeAppointmentViewModelBuilder(_context);
            var viewModel = builder.Build(id);

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult MakeAppointment(MakeAppointmentCommand command)
        {
            if (!ModelState.IsValidField("AppointmentDate"))
            {
                var builder   = new MakeAppointmentViewModelBuilder(_context);
                var viewModel = builder.Build(command.PropertyId);

                return(View(viewModel));
            }
            var handler = new MakeAppointmentCommandHandler(_context);

            command.BuyerUserId = User.Identity.GetUserId();
            handler.Handle(command);

            return(RedirectToAction("Index"));
        }