public ActionResult DeclareWar([System.Web.Http.FromBody] WarDeclarationViewModel vm) { var defender = countryRepository.GetById(vm.SelectedCountryID); if (defender == null) { return(RedirectToHomeWithError("Country does not exist!")); } var attacker = countryRepository.GetById(vm.AttackerCountryID); if (attacker == null) { return(RedirectToHomeWithError("Country does not exist!")); } if (isPresident(attacker, SessionHelper.CurrentEntity.EntityID) == false) { return(RedirectToHomeWithError("You are not a president!")); } var result = warService.CanDeclareWar(attacker, defender); if (result.IsError) { AddError(result); return(RedirectBack()); } if (ModelState.IsValid) { var warID = (int)warService.DeclareWar(attacker, defender); AddInfo("War has been declared!"); return(RedirectToAction("View", "War", new { warID = warID })); } var viewVm = new DeclareWarViewModel(attacker, countryRepository); return(View(viewVm)); }