Пример #1
0
        private static string MODULE          = "WebAPI.SawController.{0}"; // Pass method name.

        public Response <OwnerAssetChangeDto> Get(long ownerAssetChangeId)
        {
            Response <OwnerAssetChangeDto> response = new Response <OwnerAssetChangeDto>();

            try
            {
                AssetContext assetContext     = new AssetContext();
                var          ownerAssetChange = assetContext.GetOwnerAssetChangesById(ownerAssetChangeId);

                if (ownerAssetChange != null)
                {
                    response.Item = ownerAssetChange;
                    response.Code = OperationCode.ResponseCode.SUCCESS;
                    response.MessageList.Add(MessageResource.GetInstance().GetText("SawDAL_GetSuccess", MESSAGE_RESOURCE));
                }
                else
                {
                    response.Code = OperationCode.ResponseCode.NO_FOUND;
                    response.NotFoundList.Add(MessageResource.GetInstance().GetText("SawDAL_GetNotExisting", MESSAGE_RESOURCE));
                }
            }
            catch (Exception ex)
            {
                response.Item = null;
                response.Code = OperationCode.ResponseCode.ERROR;
                response.ErrorList.Add(MessageResource.GetInstance().GetText("SawIL_GetInvalid", MESSAGE_RESOURCE));
            }

            return(response);
        }