public ActionResult Treatment(int treatmentId = 0, int customerId = 0)
        {
            _logger.DebugFormat("Enter TreatmentController with behandingId: {0}", treatmentId);
            var model = new TreatmentViewModel();

            var currentCustomerId = customerId;

            if (treatmentId > 0)
            {
                var treatment = _treatmentService.GetTreatmentById(treatmentId);
                treatment.Customer = _customerService.GetCustomer(treatment.CustomerId);

                if (currentCustomerId <= 0)
                {
                    currentCustomerId = treatment.CustomerId;
                }
                //var oldAfflicaitons = _customerService.GetOldAfflicationsByCustomerId(treatment.CustomerId);
                var oldAfflicaitons = _areaAfflicationService.GetAfflicationAreasByCustomerId(treatment.CustomerId);
                oldAfflicaitons.RemoveAll(x => x.TreatmentId == treatmentId);
                foreach (var oldAfflicaiton in oldAfflicaitons)
                {
                    oldAfflicaiton.IsPersisted = true;
                }

                model = new TreatmentViewModel
                {
                    Treatment = treatment,
                    OldAfflications = oldAfflicaitons,
                    CreatedDate = DateTime.Now.ToString("dd.MM.yyyy")
                };
                if (oldAfflicaitons.Any())
                {
                    model.HasOldAfflications = true;
                }
            }
            else
            {
                model = new TreatmentViewModel
                {
                    Treatment = _treatmentFactory.BuildNewTreatmentModel(),
                };

                if (customerId > 0)
                {
                    model.Treatment.Customer = _customerService.GetCustomer(customerId);
                    model.Treatment.CustomerId = model.Treatment.Customer.CustomerId;

                    //var oldAfflicaitons = _customerService.GetOldAfflicationsByCustomerId(customerId);
                    var oldAfflicaitons = _areaAfflicationService.GetAfflicationAreasByCustomerId(customerId);

                    foreach (var oldAfflicaiton in oldAfflicaitons)
                    {
                        oldAfflicaiton.IsPersisted = true;
                    }

                    model.OldAfflications = oldAfflicaitons;

                    if (oldAfflicaitons.Any())
                    {
                        model.HasOldAfflications = true;
                    }
                }
            }

            var today = DateTime.Today;
            var age = today.Year - model.Treatment.Customer.BirthDay.GetValueOrDefault().Year;
            if (model.Treatment.Customer.BirthDay.GetValueOrDefault() > today.AddYears(-age))
            {
                age--;
            }
            model.Treatment.Customer.Age = age;

            var oldNotes = _treatmentService.GetOldTreatmentNotesByCustomerId(currentCustomerId, treatmentId);
            if (oldNotes != null)
            {
                model.Treatment.OldTreatmentNotes = oldNotes.OldNotes;
                model.Treatment.OldObservations = oldNotes.OldObservations;
                model.Treatment.OldAnamnesis = oldNotes.OldAnamnese;
            }

            return View(model);
        }
 public ActionResult Treatment(TreatmentViewModel model)
 {
     return View(model);
 }