Пример #1
0
        public async Task <bool> ValidateLead(CreateValidatedLeadDto lead)
        {
            string sUrl     = _LocalUrlBase;
            string leadJson = JsonConvert.SerializeObject(lead);

            var client = _clientFactory.CreateClient();

            var stringContent = new StringContent(content: leadJson, encoding: Encoding.UTF8, mediaType: "application/json");
            var respons       = await client.PostAsync(sUrl, stringContent);

            Console.WriteLine(respons);
            return(true);
        }
Пример #2
0
        public ActionResult <ValidatedLeadDto> ValideraLead([FromBody] CreateValidatedLeadDto lead)
        {
            var leadModel = _mapper.Map <ValidatedLead>(lead);

            _leadsRepo.ValidateLead(leadModel);
            _leadsRepo.Save();


            var leadToReturn = _mapper.Map <ValidatedLeadDto>(leadModel);

            return(CreatedAtRoute("GetValidatedLeadById",
                                  new { Id = leadModel.Id }, leadToReturn));
        }