| | |
| | | public class BimfaceFileRelation_Controller : IDynamicApiController |
| | | { |
| | | |
| | | private readonly Service.BimfaceFileRelation _service = new(); |
| | | private readonly Yw.Service.BimfaceFileRelation _service = new(); |
| | | |
| | | |
| | | #region Query |
| | |
| | | var bimfaceFile = new Yw.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<AddBimfaceFileRelationInput, Model.BimfaceFileRelation>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | |
| | | var bimfaceFile = new Yw.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<AddBimfaceFileRelationInput, Model.BimfaceFileRelation>(); |
| | | model.SortCode = _service.GetMaxSortCode(input.ObjectType, input.ObjectID) + 1; |
| | |
| | | var bimfaceFile = new Yw.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<AddBimfaceFileRelationInput, Model.BimfaceFileRelation>(); |
| | | model.SortCode = _service.GetMaxSortCode(input.BimfaceFileID) + 1; |
| | |
| | | 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.BimfaceFileRelation(model); |
| | | input.Adapt(rhs); |
| | |
| | | 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 bol = _service.DeleteExByID(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; |
| | | } |