public ActionResult Index(CollectForm collectForm) { if (ModelState.IsValid) { var ct = createTask(collectForm); uniSocialClient.StartNewTask(ct); return RedirectToAction("CollectStarted"); } else { return View(collectForm); } }
CollectTask createTask(CollectForm collectForm) { var inputFilename = collectForm.InputFile.Trim('"','\''); CollectTask ct = new CollectTask() { SocialNetwork = collectForm.Network, Method = collectForm.Method }; ct.Input = new CollectTaskIOFile() { Filename = inputFilename }; if (collectForm.OutputInDb) { //string connStr = ConfigurationManager.ConnectionStrings["postgresql"].ConnectionString; string connStr = ConfigurationManager.ConnectionStrings["sqlserver"].ConnectionString; ct.Output = new CollectTaskIODatabase() { ConnectionString = connStr }; } else { var outputFilename = collectForm.OutputFilename.Trim('"', '\''); ct.Output = new CollectTaskIOFile() { Filename = outputFilename }; } return ct; }