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)); }
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)); }
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)); }
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)); }
public ActionResult DeleteLead(int id) { var LeadFromRepo = _leadsRepo.GetLeadById(id); if (LeadFromRepo == null) { return(NotFound()); } _leadsRepo.DeleteLead(LeadFromRepo); _leadsRepo.Save(); return(NoContent()); }