public ActionResult Edit(int id) { TreatmentCategoryEditItem treatmentCategoryItem = new TreatmentCategoryEditItem(); if (id != 0) { var treatmentCategory = Manager.GetById(id); if (treatmentCategory != null) { treatmentCategoryItem.Id = treatmentCategory.Id; treatmentCategoryItem.Name = treatmentCategory.Name; treatmentCategoryItem.Description = treatmentCategory.Description; treatmentCategoryItem.PictureUrl = treatmentCategory.PictureUrl; treatmentCategoryItem.HasTreatments = TreatmentManager.IsAnyInCategory(treatmentCategory.Id); treatmentCategoryItem.IsActive = treatmentCategory.IsActive; } } return(View("TreatmentCategoryEditView", treatmentCategoryItem)); }