Exemple #1
0
        public ActionResult Edit(ActivityBindingModel model, int id)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Id = id;

                return(View());
            }

            var activity = service.Get(id);

            activity.Name     = model.Name;
            activity.Duration = model.Duration;
            activity.Price    = model.Price;
            service.Update(activity);

            return(RedirectToAction("Index", "Appointment"));
        }
Exemple #2
0
        public ActionResult Create(ActivityBindingModel model, int appointmentId)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.AppointmentId = appointmentId;

                return(View());
            }

            var activity = new Activity()
            {
                Name          = model.Name,
                Duration      = model.Duration,
                Price         = model.Price,
                AppointmentId = appointmentId
            };

            service.Create(activity);

            return(RedirectToAction("Index", "Appointment"));
        }