public ActionResult Edit(MiniSiteShortModel model, GridCommand command) { string storeUrl = (new Uri(_storeInformationSettings.StoreUrl)).Host; var miniSite = _miniSiteService.GetMiniSiteById(model.Id); if (miniSite.Active != model.Active) { if (miniSite.Active) { _miniSiteEmailSender.SendMiniSiteRejectEmail(miniSite.Id, _languageService.GetAllLanguages().Where(x => x.UniqueSeoCode == "ru").FirstOrDefault().Id); try { string result = _webHelper.DeleteWebSiteBinding(miniSite.DomainName, storeUrl); SuccessNotification(result + "\nBinding deleted succesfully"); } catch (FaultException ex) { if (ex.Message != "Binding not found!") { throw ex; } } } else { _miniSiteEmailSender.SendMiniSiteAcceptEmail(miniSite.Id, _languageService.GetAllLanguages().Where(x => x.UniqueSeoCode == "ru").FirstOrDefault().Id); string result = _webHelper.AddWebSiteBinding(model.DomainName, storeUrl); SuccessNotification(result + "\nBinding added succesfully"); } miniSite.Active = model.Active; } else { if (miniSite.DomainName != model.DomainName) { if (model.Active) { try { string result = _webHelper.DeleteWebSiteBinding(miniSite.DomainName, storeUrl); SuccessNotification(result + "\nBinding deleted succesfully"); } catch (FaultException ex) { if (ex.Message != "Binding not found!") { throw ex; } } string res = _webHelper.AddWebSiteBinding(model.DomainName, storeUrl); SuccessNotification(res + "\nBinding added succesfully"); } } } miniSite.DomainName = model.DomainName; _miniSiteService.UpdateMiniSite(miniSite); return(List(command)); }