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")); }
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")); }