Пример #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
        /// <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
        /// <summary>
        /// Delete process.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>ResponseModel</returns>
        public DeleteResponseModel Invoke(DeleteRequestModel request)
        {
            var responseModel = Execute(request);

            return(responseModel);
        }
 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);
 }