public async Task <IActionResult> CreateSubscriptionUtility([FromBody] CreateUtilityRequest request) { var createserviceSubcriptionCommand = new CreateUtilityCommand(request); var result = await mediator.Send(createserviceSubcriptionCommand); return(StatusCode((int)result.Code, result.Value)); }
public async Task <APIResponse> CreateUtility(CreateUtilityRequest request) { try { var client = httpClientFactory.CreateClient(VendorServiceOperation.serviceName); var param = JsonConvert.SerializeObject(request); HttpContent contentPost = new StringContent(param, Encoding.UTF8, "application/json"); var response = await client.PostAsync(servicesConfig.Vendor + VendorServiceOperation.Createutility(), contentPost); if (response.IsSuccessStatusCode) { var multidetail = JsonConvert.DeserializeObject <UtilityIdDetails>(await response.Content.ReadAsStringAsync()); return(new APIResponse(multidetail, HttpStatusCode.Created)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'CreateMultiDetails()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Initializes a new instance of the <see cref="CreateStoryCommand"/> class. /// </summary> /// <param name="request">The request.</param> public CreateUtilityCommand(CreateUtilityRequest request) { Request = request; }
public async Task <IActionResult> CreateUtility([FromBody] CreateUtilityRequest request) { var result = await utilityService.CreateUtility(request); return(StatusCode((int)result.Code, result.Value)); }