public async Task <ActionResult> AddCountry(CountryAddModel Country) { if (ModelState.IsValid) { await CountryService.Add(Country); return(RedirectToAction("Index")); } return(View("Add")); }
public async Task Add(CountryAddModel Country) { await repository.Add(new KadabraCountry() { ImageFlag = Country.ImageFlag, Name = Country.Name, CountryKey = Country.CountryKey, Id = Guid.NewGuid().ToString() }); await repository.Save(); }
/// <summary> /// Update Country /// </summary> /// <param name="countryAddModel"></param> /// <returns></returns> public CountryAddModel UpdateCountry(CountryAddModel countryAddModel) { CountryAddModel countryUpdate = new CountryAddModel(); if (TokenManager.CheckToken(countryAddModel._tenantName + countryAddModel._userName, countryAddModel._token)) { countryUpdate = this.commonRepository.UpdateCountry(countryAddModel); } else { countryUpdate._failure = true; countryUpdate._message = TOKENINVALID; } return(countryUpdate); }
public ActionResult <CountryAddModel> DeleteCountry(CountryAddModel countryValue) { CountryAddModel countryModel = new CountryAddModel(); try { countryModel = _commonService.DeleteCountry(countryValue); } catch (Exception es) { countryModel._failure = true; countryModel._message = es.Message; } return(countryModel); }
public ActionResult <CountryAddModel> UpdateCountry(CountryAddModel countryAddModel) { CountryAddModel countryUpdate = new CountryAddModel(); try { countryUpdate = _commonService.UpdateCountry(countryAddModel); } catch (Exception es) { countryUpdate._failure = true; countryUpdate._message = es.Message; } return(countryUpdate); }
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 Add(CountryAddModel country) { HttpResponseMessage response = await apiClient.PostAsJsonAsync("Kadabra/Country/AddCountry", country); response.EnsureSuccessStatusCode(); }