示例#1
0
        public async Task <IActionResult> AddCountry([FromBody] CountryModel model)
        {
            //var currentUser = CurrentUser();
            //model. = currentUser?.UserId;

            var add = await _countryManager.AddCountry(model);

            return(Ok(new ApiResponse <CountryModel>()
            {
                Data = model,
                Message = "Succeeded",
                StatusCode = HttpStatusCode.OK
            }));
        }
        public async Task <IActionResult> AddCountry([FromBody] CountryModel model)
        {
            //var currentUser = CurrentUser();
            //model. = currentUser?.UserId;

            var add = await _countryManager.AddCountry(model);

            await _auditRepository.Add(new AuditModel { AuditType = "Add Country", Description = User.Identity.Name + "Added a new Country", AuthUser = User.Identity.Name });

            return(Ok(new ApiResponse <CountryModel>()
            {
                Data = model,
                Message = "Succeeded",
                StatusCode = HttpStatusCode.OK
            }));
        }
示例#3
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 }));
        }