public ActionResult Detail(int id) { TypeVM typeViewModel = new TypeVM(); TypeRepository repository = new TypeRepository(); DataOperations dataOperations = new DataOperations(); TypeDTO typeDTO = repository.GetTypeDTOByID(id); typeViewModel.ParentID = typeDTO.ParentID; typeViewModel.ParentName = typeDTO.ParentTypeName; typeViewModel.ID = typeDTO.ID; typeViewModel.Name = typeDTO.Name; typeViewModel.Description = typeDTO.Description; if (typeDTO != null) { typeViewModel.RTypeList = dataOperations.GetTypeByParentId(typeDTO.ID); } return(PartialView(typeViewModel)); }