コード例 #1
0
        public async Task <ActionResult> AddCountry(Country country, string FaithName, string PolityName)
        {
            Faith faith = await _faithManager.GetFaithByName(FaithName);

            if (faith == null)
            {
                faith = await _faithManager.AddFaith(new Faith { Name = FaithName });
            }
            Polity polity = await _polityManager.GetPolityByName(PolityName);

            if (polity == null)
            {
                polity = await _polityManager.AddPolity(new Polity { Name = PolityName });
            }
            country.faith  = faith;
            country.Polity = polity;


            Country cntr = await _manager.AddCountry(country);

            return(RedirectToAction("ShowCountry", "Country", new { Id = cntr.Id }));
        }
コード例 #2
0
        public async Task <ActionResult> AddFaith(Faith faith)
        {
            Faith ft = await _manager.AddFaith(faith);

            return(RedirectToAction("ShowFaith", "Faith", new { Id = ft.Id }));
        }