Exemple #1
0
        private static string MODULE          = "WebAPI.SawController.{0}"; // Pass method name.

        public Response <AssetDto> Get(long assetId)
        {
            Response <AssetDto> response = new Response <AssetDto>();

            try
            {
                AssetContext assetContext = new AssetContext();
                var          asset        = assetContext.GetAssetById(assetId);

                if (asset != null)
                {
                    response.Item = asset;
                    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);
        }