| | |
| | | [ApiDescriptionSettings("Bimface", Name = "Bimface文件标签", Order = 90000)] |
| | | public class BimfaceFileLabel_Controller : IDynamicApiController |
| | | { |
| | | private readonly Service.BimfaceFileLabel _service = new(); |
| | | private readonly Yw.Service.BimfaceFileLabel _service = new(); |
| | | |
| | | #region Query |
| | | |
| | |
| | | { |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | | { |
| | | return default; |
| | | } |
| | | return new BimfaceFileLabelDto(model); |
| | | } |
| | | |
| | |
| | | var bimfaceFile = new Service.BimfaceFile().GetByID(input.BimfaceFileID); |
| | | if (bimfaceFile == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"BimfaceFileID:{input.BimfaceFileID} 数据不存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"BimfaceFileID:{input.BimfaceFileID} 数据不存在"); |
| | | } |
| | | var model = input.Adapt<AddBimfaceFileLabelInput, Model.BimfaceFileLabel>(); |
| | | var id = _service.Insert(model); |
| | |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"ID:{input.ID} 数据不存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 数据不存在"); |
| | | } |
| | | |
| | | var rhs = new Model.BimfaceFileLabel(model); |
| | |
| | | var bol = _service.DeleteByID(input.ID, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, Msg); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | |
| | | var bimfaceFile = new Service.BimfaceFile().GetByID(input.BimfaceFileID); |
| | | if (bimfaceFile == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"BimfaceFileID:{input.BimfaceFileID} 数据不存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"BimfaceFileID:{input.BimfaceFileID} 数据不存在"); |
| | | } |
| | | var list = input.Labels?.Select(x => x.Adapt<SaveBimfaceFileLabelItemInput, Model.BimfaceFileLabel>()).ToList(); |
| | | list?.ForEach(x => x.BimfaceFileID = input.BimfaceFileID); |
| | | var bol = _service.Save(input.BimfaceFileID, list, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, Msg); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, Msg); |
| | | } |
| | | return bol; |
| | | } |