コード例 #1
0
        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"));
        }
コード例 #2
0
        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"));
            }
        }