Example #1
0
        public ActionResult <SentOutLeadDto> SendLead(CreateSentOutLeadDto sentOutLead)
        {
            var leadModel = _mapper.Map <SentOutLead>(sentOutLead);

            _leadsRepo.SendLead(leadModel);
            _leadsRepo.Save();

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

            return(CreatedAtRoute("GetSentOutLeadById",
                                  new { Id = leadModel.Id }, leadToReturn));
        }
Example #2
0
        public async Task <bool> SendLead(CreateSentOutLeadDto 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);
        }