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 bool UpdateWebSettingsForCountry(WebSettingsEditModel entity, Guid countryId) { WebSettings webSettings = _repository.GetWebSettingsForCountry(countryId); if (webSettings == null) { throw new Exception(); } webSettings.Phone = entity.Phone; webSettings.Email = entity.Email; webSettings.Address = entity.Address; webSettings.LogoImagePath = entity.LogoImagePath; webSettings.Title = entity.Title; webSettings.FacebookSocialLink = entity.FacebookSocialLink; webSettings.TwitterSocialLink = entity.TwitterSocialLink; webSettings.VKSocialLink = entity.VKSocialLink; webSettings.InstagramSocialLink = entity.InstagramSocialLink; webSettings.GooglePlusSocialLink = entity.GooglePlusSocialLink; return(_repository.UpdateWebSettingsForCountry(webSettings)); }
public void Put([FromBody] WebSettingsEditModel model) { Ok(_webSettingsService.UpdateWebSettingsForCountry(model, model.CountryId)); }