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 JsonResult AddSecondStep(string token, string firstName, string lastName, string email, string countryCode, string phoneNumber, string aliases, string keywords, string productName, string productURL, string marketSegments, string otherMarketSegments, string competitors, string notes, string idLead) { //TODO Prepare Image for Database var leadDto = new LeadDto() { //The intake token to identify the "lead" in the database IntakeToken = token, //from the First Step FirstName = firstName, LastName = lastName, Email = email, CountryCode = countryCode, PhoneNumber = phoneNumber, DateUpdated = DateTime.Now, DateCreated = DateTime.Now, IntakeUrl = "", //From the 2nd step Aliases = aliases, Keywords = keywords, ProductName = productName, ProductURL = productURL, MarketSegments = marketSegments, OtherMarketSegments = otherMarketSegments, Competitors = competitors, Notes = notes, IsActive = true, idLead = int.Parse(idLead) }; var urlToValidateUser = ConfigurationManager.AppSettings["SmartSocialWeb"]; return(Json(_leadService.UpdateLead(leadDto, urlToValidateUser), JsonRequestBehavior.AllowGet)); }
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)); }