public async Task <ActionResult> AddCountry(CountryAddModel Country) { if (ModelState.IsValid) { await CountryService.Add(Country); return(RedirectToAction("Index")); } return(View("Add")); }
public async Task <IHttpActionResult> AddCountry(CountryAddModel country) { if (!ModelState.IsValid) { return(this.InternalServerError()); } try { await services.Add(country); return(Ok()); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <ActionResult <Country> > PostCountry(Country country) { await services.Add(country); return(CreatedAtAction("GetCountry", new { id = country.Id }, country)); }