public object RunRequest(AddLeadRequest request) { var response = new AddLeadResponse(); var AgentId = _dbContext.Agent.Where(x => x.UserId == request.UserId).FirstOrDefault().Id; var Lead = new LMS.Models.EntityModel.Lead(); Lead.AgentId = AgentId; Lead.CompanyId = request.CompanyId; Lead.CreatedAt = DateTime.Today; Lead.Date = DateTime.Now.Date; Lead.CreatedBy = request.CreatedBy; Lead.Name = request.Name; Lead.Address = request.Address; Lead.Email = request.Email; Lead.ModeOfCommunication = request.MOCId; Lead.BusinessOperationTime = request.BOT; Lead.AlternateNumber = request.CompanyAlternateContact; Lead.Contact = request.Contact; Lead.ContactPersonName = request.ContactPersonName; Lead.ContactPersonNumber = request.ContactPersonNumber; Lead.ContactPersonEmail = request.ContactPersonEmail; Lead.ContactPersonTitle = request.ContactPersonTitle; Lead.ContactPersonDepartment = request.ContactPersonDepartment; Lead.Domain = request.Domain; Lead.Website = request.Website; Lead.Area = request.Area; Lead.City = request.City; Lead.NoEmployee = request.NOE; Lead.BusinessIndustry = request.BusinessIndustry; Lead.NTN = request.NTN; Lead.NumberOfBranchOffices = request.NoBracnhOffices; Lead.RequiredMedium = request.RequiredMedium; Lead.CurrentlyUsedMedium = request.CurrentlyUsedMedium; Lead.NoLinks = request.NoLinks; Lead.Budget = request.Budget; Lead.EstimatedClosingDate = request.EstimatedClosingDate; Lead.IsEsisting = request.IsEsisting; Lead.HasTriedOurServie = request.HasTriedOurServie; Lead.Comments = request.Comments; Lead.Bandwidth = request.Bandwidth; Lead.ConnectivityType = request.ConnectivityType; Lead.LeadStatus = (int)LeadStatus.Open; Lead.PmdStatus = (int)PmdStatus.None; Lead.QuotationStatus = (int)QuotationStatus.None; //Lead.IsApproved = var result = _dbContext.Lead.Add(Lead); _dbContext.SaveChanges(); return(response); }
public object RunRequest(AddLeadNewRequest request) { var response = new AddLeadNewResponse(); var AgentId = _dbContext.Agent.Where(x => x.UserId == request.UserId).FirstOrDefault().Id; var Lead = new LMS.Models.EntityModel.Lead(); Lead.AgentId = AgentId; Lead.CreatedAt = DateTime.Today; Lead.Date = DateTime.Now.Date; Lead.CreatedBy = request.CreatedBy; //Lead.Name = request.Name; //CompanyInfo Lead.Address = request.CompanyDetails.Address; Lead.CompanyId = request.CompanyId; Lead.Email = request.CompanyDetails.Email; Lead.ModeOfCommunication = request.CompanyDetails.MOCId; Lead.BusinessOperationTime = request.CompanyDetails.BOT; Lead.AlternateNumber = request.CompanyDetails.CompanyAlternateContact; Lead.Contact = request.CompanyDetails.Contact; Lead.Website = request.CompanyDetails.Website; Lead.Area = request.CompanyDetails.Area; Lead.City = request.CompanyDetails.City; Lead.NoEmployee = request.CompanyDetails.NOE; Lead.BusinessIndustry = request.CompanyDetails.BusinessIndustry; Lead.NTN = request.CompanyDetails.NTN; Lead.NoLinks = request.CompanyDetails.NoLinks; Lead.Domain = request.Domain; //POCs Lead.ContactPersonName = request.ContactPersonName; Lead.ContactPersonNumber = request.ContactPersonNumber; Lead.ContactPersonEmail = request.ContactPersonEmail; Lead.ContactPersonTitle = request.ContactPersonTitle; Lead.ContactPersonDepartment = request.ContactPersonDepartment; if (request.Domain == (int)LMS.Models.Enums.Domain.Connectivity) { Lead.NumberOfBranchOffices = request.ConnectivityDetails.NoBracnhOffices; Lead.RequiredMedium = request.ConnectivityDetails.RequiredMedium; Lead.CurrentlyUsedMedium = request.ConnectivityDetails.CurrentlyUsedMedium; Lead.Budget = request.ConnectivityDetails.Budget; Lead.EstimatedClosingDate = request.ConnectivityDetails.EstimatedClosingDate; Lead.IsEsisting = request.ConnectivityDetails.IsEsisting; Lead.HasTriedOurServie = request.ConnectivityDetails.HasTriedOurServie; Lead.Comments = request.ConnectivityDetails.Comments; Lead.Bandwidth = request.ConnectivityDetails.Bandwidth; Lead.ConnectivityType = request.ConnectivityDetails.ConnectivityType; } Lead.LeadStatus = (int)LeadStatus.Open; Lead.PmdStatus = (int)PmdStatus.None; Lead.QuotationStatus = (int)QuotationStatus.None; Lead.Date = DateTime.Now.Date; //Lead.IsApproved = var result = _dbContext.Lead.Add(Lead); if (request.Domain == (int)LMS.Models.Enums.Domain.SolutionSet) { var SolutionSet = new LMS.Models.EntityModel.SolutionDetails(); SolutionSet.LeadId = result.Id;//request.SolutionDetails.LeadId; SolutionSet.IsNew = request.SolutionDetails.IsNew; SolutionSet.OtherMeasurements = request.SolutionDetails.OtherMeasurements; SolutionSet.Quantity = request.SolutionDetails.Quantity; SolutionSet.Remarks = request.SolutionDetails.Remarks; SolutionSet.SolutionServiceProduct = request.SolutionDetails.SolutionServiceProduct; SolutionSet.SolutionServiceProvider = request.SolutionDetails.SolutionServiceProvider; SolutionSet.SolutionSubType = request.SolutionDetails.SolutionSubType; SolutionSet.SolutionType = request.SolutionDetails.SolutionType; SolutionSet.CurrentServiceInfo = request.SolutionDetails.CurrentServiceInfo; SolutionSet.Duration = request.SolutionDetails.Duration; SolutionSet.CreatedAt = DateTime.Now; SolutionSet.Date = DateTime.Now.Date; SolutionSet.CreatedBy = request.CreatedBy; var SolutionResult = _dbContext.SolutionDetails.Add(SolutionSet); _dbContext.SaveChanges(); } _dbContext.SaveChanges(); return(response); }