public async Task <ActionResult> Create(LeadViewModel leadViewModel) { Lead lead = Lead.LeadViewModelToLead(leadViewModel); try { int itemId = await lead.CreateLead(lead); if (itemId != default(int)) { TempData["message"] = "New lead added succesfully"; } } catch (PodioException ex) { ViewBag.error = ex.Error.ErrorDescription; } return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit(LeadViewModel leadViewModel, string command) { if (command == "Update") { Lead lead = Lead.LeadViewModelToLead(leadViewModel); try { await lead.UpdateLead(lead); TempData["message"] = "Lead updated successfully"; } catch (PodioException ex) { ViewBag.error = ex.Error.ErrorDescription; } return(RedirectToAction("Edit", new { id = lead.PodioItemID })); } else { return(RedirectToAction("Index")); } }