public async Task <IActionResult> CreateCountry([FromBody] CreateCountryModel createCountryModel) { CreateCountryDto createCountryDto = _mapper.Map <CreateCountryDto>(createCountryModel); await _countryService.CreateCountryAsync(createCountryDto); return(Ok()); }
public async Task <ActionResult <CountryModel> > Post([FromBody] CreateCountryModel model) { try { return(Ok(await this.handler.CreateAsync(model))); } catch (Exception) { // here we should capture the custom exception to return the correct response throw; } }
public async Task <IActionResult> Post(int organizationId, [FromBody] CreateCountryModel createCountryModel) { string email = User.Identity.Name; await countryService.AddCountryAsync( organizationId, mapper.Map <CreateCountryModel, CreateCountryDto>(createCountryModel), email ); return(Ok()); }
public IHttpActionResult Post([FromBody] CreateCountryModel model) { var country = new Country { Name = model.Name, CountryCode1 = model.CountryCode, Display = true }; db.Country.Add(country); db.SaveChanges(); return(Ok(country.Id)); }