public ActionResult Config(TwitterConfigModel m) { if (m.IncludePath != null) { var include = AppService.GetInclude<TwitterInclude>(m.IncludePath); m.Username = include.Username; m.Count = include.Count; } return PartialView("TwitterConfig", m); }
public ActionResult PostConfig(TwitterConfigModel m) { if (string.IsNullOrEmpty(m.Username) || m.Username.Trim().Length == 0) ModelState.AddModelError("username", "Please supply a Twitter user to show the public feed."); if (!ModelState.IsValidField("count")) ModelState.AddModelError("count", "Please enter a valid number for the count."); if (ModelState.IsValid) { var appSvc = AppServiceRepository.GetService(); var include = appSvc.GetInclude<TwitterInclude>(m.IncludePath); include.Username = m.Username; include.Count = m.Count.Value; AppServiceRepository.UpdateService(appSvc); return Json(new { success = true, includePath = m.IncludePath }); } return PartialView("TwitterConfig", m); }