示例#1
0
        public Response <bool> DeleteAsset(int assetId)
        {
            Response <bool> response = new Response <bool>();

            try
            {
                AssetContext assetContext = new AssetContext();
                var          wasDeleted   = assetContext.DeleteAsset(assetId);
                if (wasDeleted)
                {
                    response.Item = true;
                    response.Code = OperationCode.ResponseCode.SUCCESS;
                    response.MessageList.Add(MessageResource.GetInstance().GetText("SawDAL_DeleteSuccess", MESSAGE_RESOURCE));
                }
                else
                {
                    response.Code = OperationCode.ResponseCode.ERROR;
                    response.ErrorList.Add(MessageResource.GetInstance().GetText("SawDAL_DeleteInvalid", MESSAGE_RESOURCE));
                }
            }
            catch (Exception ex)
            {
                response.Code = OperationCode.ResponseCode.ERROR;
                response.ErrorList.Add(MessageResource.GetInstance().GetText("SawDAL_DeleteInvalid", MESSAGE_RESOURCE));
            }
            return(response);
        }