Пример #1
0
        public ActionResult <CompanyDto> AddCompany(CreateCompanyDto company)
        {
            var companyModel = _mapper.Map <Company>(company);

            _leadsRepo.AddCompany(companyModel);
            _leadsRepo.Save();

            var companyToReturn = _mapper.Map <CompanyDto>(companyModel);

            return(CreatedAtRoute("GetCompanyById",
                                  new { Id = companyModel.Id }, companyToReturn));
        }
Пример #2
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));
        }
Пример #3
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));
        }
Пример #4
0
        public ActionResult <CompletedLeadDto> CompleteLead(CreateCompletedLeadDto lead)
        {
            var leadModel = _mapper.Map <CompletedLead>(lead);

            _leadsRepo.CompleteLead(leadModel);
            _leadsRepo.Save();


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

            return(CreatedAtRoute("GetCompletedLeadById",
                                  new { Id = leadModel.Id }, leadToReturn));
        }
Пример #5
0
        public ActionResult DeleteLead(int id)
        {
            var LeadFromRepo = _leadsRepo.GetLeadById(id);

            if (LeadFromRepo == null)
            {
                return(NotFound());
            }
            _leadsRepo.DeleteLead(LeadFromRepo);
            _leadsRepo.Save();

            return(NoContent());
        }