示例#1
0
        public ActionResult Create()
        {
            var appointment = new Appointment();

            appointment.TimeRange = new TimeRange();
            var model = new ViewModel_CreateAppointment();

            model.Appointment  = appointment;
            model.Hairdressers = _hg.GetAll();
            model.Customers    = _cg.GetAll();
            return(View(model));
        }
示例#2
0
        public ActionResult Edit(ViewModel_CreateAppointment model)
        {
            Appointment appointment = model.Appointment;

            appointment.Hairdresser    = new Hairdresser();
            appointment.Hairdresser.ID = model.selectedHairdresserID[0];
            appointment.Customer       = new Customer();
            appointment.Customer.ID    = model.selectedCustomerID[0];
            if (ModelState.IsValid)
            {
                _ag.Update(appointment);
            }
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Appointment appointment = _ag.Get(id.Value);
            var         model       = new ViewModel_CreateAppointment();

            model.Appointment  = appointment;
            model.Hairdressers = _hg.GetAll();
            model.Customers    = _cg.GetAll();

            if (appointment == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }