private bool IsFacebookNotificationResponseValid(StartPoemModel startPoem) { return startPoem.FacebookNotificationResponse != null && startPoem.FacebookNotificationResponse.Request >= 0 && startPoem.FacebookNotificationResponse.To != null && startPoem.FacebookNotificationResponse.To.Count != 0; }
private bool IsStartRequestValid(StartPoemModel startPoem, VerseEngineeringUser user) { if (!ModelState.IsValid) { return false; } if (!IsFacebookNotificationResponseValid(startPoem)) { logger.Error( string.Format( "Facebook notification response is invalid\n {0}", startPoem.FacebookNotificationResponse)); return false; } if (user == null) { logger.Error(string.Format("VerseEngineeringUser is null after authorization")); return false; } return true; }
public ActionResult Start(StartPoemModel startPoem, VerseEngineeringUser user) { if (!IsStartRequestValid(startPoem, user)) { return View(startPoem); } if (user == null) { logger.Error(string.Format("VerseEngineeringUser is null after authorization")); return View(startPoem); } StartPoemConfiguration poemConfig = new ClassicalPoemConfiguration( user.UserId, startPoem.PoemTitle, startPoem.PoemDescription, startPoem.FacebookNotificationResponse.To, startPoem.FacebookNotificationResponse.Request); long poemId = poemService.StartNewPoem(poemConfig); return RedirectToAction("Play", new { poemId }); }