public ActionResult Create(LeadCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new LeadService(); service.CreateLead(model); return(RedirectToAction("Index")); }
public ActionResult LeadCreate(LeadCreate model) { if (!ModelState.IsValid) { return(View(model)); } var userId = Guid.Parse(User.Identity.GetUserId()); var service = new LeadService(userId); service.CreateLead(model); return(RedirectToAction("LeadIndex")); }
public IHttpActionResult Post(LeadCreate lead) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateLeadService(); if (!service.CreateLead(lead)) { return(InternalServerError()); } return(Ok()); }
public bool CreateLead(LeadCreate model) { var entity = new Lead() { Name = model.Name, Company = model.Company, Phone = model.Phone, Email = model.Email, Converted = model.Converted }; using (var ctx = new ApplicationDbContext()) { ctx.Leads.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(LeadCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateLeadService(); if (service.CreateLead(model)) { TempData["SaveResult"] = "Your Lead was created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "Lead could not be created."); return(View(model)); }
public bool CreateLead(LeadCreate model) { var entity = new Lead() { OwnerID = _userId, Company = model.Company, Role = model.Role, StatusID = model.StatusID, SourceID = model.SourceID, JobDescriptionLink = model.JobDescriptionLink, ResumeID = model.ResumeID, CoverID = model.CoverID, OtherArtifactID = model.OtherArtifactUsedID, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.Leads.Add(entity); return(ctx.SaveChanges() == 1); } }