コード例 #1
0
        public ApiResponseModel <Profile> Delete(string userToken, int profileId)
        {
            ApiResponseModel <Profile> result = new ApiResponseModel <Profile>();

            using (HttpClient httpClient = new HttpClient())
            {
                httpClient.BaseAddress = new Uri(ConfigHelper.ApiUrl);
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", userToken);
                var portalApiRequestModel = new DeleteRequestModel();
                portalApiRequestModel.UserToken = userToken;
                portalApiRequestModel.Id        = profileId;
                HttpResponseMessage response = httpClient.PostAsJsonAsync(string.Format("Profile/Delete"), portalApiRequestModel).Result;
                result = response.Content.ReadAsAsync <ApiResponseModel <Profile> >().Result;
            }
            return(result);
        }
コード例 #2
0
ファイル: DeleteLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Execute processing.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>ResponseModel</returns>
        private DeleteResponseModel Execute(DeleteRequestModel request)
        {
            // Local variable declaration
            DeleteResponseModel responseModel = null;
            DeleteDataModel     inputObject   = null;
            DeleteDataModel     resultObject  = null;

            // Variable initialize
            responseModel = new DeleteResponseModel();

            // Execute convert input.
            inputObject = Convert(request);

            // Get infomation
            resultObject = DeleteInfo(inputObject);

            // Execute convert ouput.
            responseModel = Convert(resultObject);

            return(responseModel);
        }
コード例 #3
0
ファイル: DeleteLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Delete process.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>ResponseModel</returns>
        public DeleteResponseModel Invoke(DeleteRequestModel request)
        {
            var responseModel = Execute(request);

            return(responseModel);
        }
コード例 #4
0
 public async Task <DeleteResponse <IUser> > Handle(DeleteRequestModel <IUser> request, CancellationToken cancellationToken)
 {
     return(await DeleteItem(request));
 }
コード例 #5
0
 public async Task Handle(DeleteRequestModel <IUser> notification, CancellationToken cancellationToken)
 {
     await _searchIndexer.RemoveItem <IUser>(notification.Id);
 }