public ActionResult Create(TreatmentCreateViewModel model) { if (ModelState.IsValid) { List<Therapist> allThera = new List<Therapist>(); foreach (int id in model.SelectedTherapistId) { Therapist thera = service.TherapistGateway.GetOne(id); allThera.Add(thera); } Treatment treatment = new Treatment { Name = model.Name, Description = model.Description, Price = model.Price, Duration = model.Duration, TreatmentTypeId = model.SelectedTypeId, Therapists = allThera }; service.TreatmentGateway.CreateOne(treatment); return RedirectToAction("Index"); } return View(); }
// GET: Treatment/Create public ActionResult Create() { var model = new TreatmentCreateViewModel { Therap = GetTherapists(), Types = GetTypes() }; return View(model); }