public ActionResult LeadEdit(int id, LeadEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.LeadID != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var userId = Guid.Parse(User.Identity.GetUserId()); var service = new LeadService(userId); if (service.UpdateLead(model)) { TempData["SaveResult"] = "Your Lead was updated."; return(RedirectToAction("LeadIndex")); } ModelState.AddModelError("", "Your Lead could not be updated."); return(View(model)); }
public ActionResult Edit(int id) { var service = CreateLeadService(); var detail = service.GetLeadById(id); var model = new LeadEdit { LeadId = detail.LeadId, Content = detail.Content, Status = detail.Status, }; return(View(model)); }
public IHttpActionResult Put(LeadEdit lead) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateLeadService(); if (!service.UpdateLead(lead)) { return(InternalServerError()); } return(Ok()); }
public bool UpdateLead(LeadEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Leads .Single(e => e.LeadId == model.LeadId); entity.Content = model.Content; entity.Status = (string)model.Status; return(ctx.SaveChanges() == 1); } }
public bool UpdateLead(LeadEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Leads .Single(e => e.ID == model.ID); // && e.OwnerId == _userId); entity.Name = model.Name; entity.Company = model.Company; entity.Phone = model.Phone; entity.Email = model.Email; entity.Converted = model.Converted; return(ctx.SaveChanges() == 1); } }
public ActionResult Edit(int id) { var service = new LeadService(); var detail = service.GetLeadByID(id); var model = new LeadEdit { ID = detail.ID, Name = detail.Name, Company = detail.Company, Phone = detail.Phone, Email = detail.Email, Converted = detail.Converted }; return(View(model)); }
public bool UpdateLead(LeadEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Leads .Single(e => e.LeadID == model.LeadID && e.OwnerID == _userId); entity.Company = model.Company; entity.Role = model.Role; entity.SourceID = model.SourceID; entity.StatusID = model.StatusID; entity.JobDescriptionLink = model.JobDescriptionLink; entity.ResumeID = model.ResumeID; entity.CoverID = model.CoverID; entity.OtherArtifactID = model.OtherArtifactID; entity.ModifiedUtc = DateTimeOffset.UtcNow; return(ctx.SaveChanges() == 1); } }
public ActionResult LeadEdit(int id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new LeadService(userId); var detail = service.GetLeadById(id); var model = new LeadEdit { LeadID = detail.LeadID, Role = detail.Role, Company = detail.Company, StatusID = detail.StatusID, SourceID = detail.SourceID, JobDescriptionLink = detail.JobDescriptionLink, ResumeID = detail.ResumeID, CoverID = detail.CoverID, OtherArtifactID = detail.OtherArtifactID, CreatedUtc = DateTimeOffset.Now }; return(View(model)); }
public ActionResult Edit(int id, LeadEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.ID != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = new LeadService(); if (service.UpdateLead(model)) { TempData["SaveResult"] = "Lead Details Successfully Updated"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Failed to Update Lead"); return(View(model)); }
public ActionResult Edit(int id, LeadEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.LeadId != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = CreateLeadService(); if (service.UpdateLead(model)) { TempData["SaveResult"] = "Your Lead was updated."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Your Lead could not be updated."); return(View(model)); }