public async Task <IActionResult> Edit(WebSettingsEditModel webSettings) { if (ModelState.IsValid) { try { _webSettingsService.UpdateWebSettingsForCountry(webSettings, CountryId); } catch (DbUpdateConcurrencyException) { if (!WebSettingsExistsForCountry(CountryId)) { _logger.LogError(LOCALIZATION_ERROR_NOT_FOUND); return(NotFound().WithError(LOCALIZATION_ERROR_NOT_FOUND)); } else { _logger.LogError(LOCALIZATION_ERROR_NOT_FOUND); return(NotFound().WithError(LOCALIZATION_ERROR_NOT_FOUND)); } } return(RedirectToAction(nameof(Details)).WithSuccess(LOCALIZATION_SUCCESS_DEFAULT)); } return(View(webSettings)); }
public void UpdateWebSettingsForCountryTest() { var entity = _memoryDbContext.WebSettings.FirstOrDefault(); var webSettingsEditModel = Builder <WebSettingsEditModel> .CreateNew().Build(); Assert.IsTrue(_webSettingsService.UpdateWebSettingsForCountry(webSettingsEditModel, CountryId)); }
public void Put([FromBody] WebSettingsEditModel model) { Ok(_webSettingsService.UpdateWebSettingsForCountry(model, model.CountryId)); }