public async Task <ActionResult> Edit(string id) { if (id == null) { _logger.Trace("No parameters passed for Edit"); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var dto = await _classTypeService.GetClassType(id); if (dto == null) { _logger.Info($"Parameter {id} was passed for Edit but did not return a result"); return(HttpNotFound()); } var viewModel = new EditClassTypeViewModel(dto); return(View(viewModel)); }
/// <summary> /// !!! Перед использование не забудь вызвать первый раз FCService.Init() /// </summary> private static IClassificator GetClassificator(Entity ent, IClassTypeService classService) { IClassificator res = null; FCEntProps fcEntProps; if (FCService.GetEntityProperties(ent.Id, out fcEntProps)) { ClassType clType; if (classService == null) { clType = new ClassType(fcEntProps.Class, fcEntProps.Class, null, 0); } else { clType = classService?.GetClassType(fcEntProps.Class); } // Если класс проектируемого здания или есть параметр высоты, то это здание ???!!! Сомнительно. Нужна более строгая идентификайция зданий var height = fcEntProps.GetPropertyValue <double>(Building.PropHeight, 0); if (height != 0 || Building.IsBuildingClass(clType.ClassName)) { var building = new Building(ent, height, fcEntProps.GetProperties(), clType); res = building; } else { double area = GetArea(ent, clType.UnitFactor, clType.ClassName); if (area != 0) { var classificator = new Classificator(ent, clType, area); res = classificator; } } } return(res); }