public ActionResult Business(AdminBusinessSettingViewModel setting) { if (ModelState.IsValid) { using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork()) { try { SettingsService.SetSetting(AppConstants.STBusinessName, setting.BusinessName); SettingsService.SetSetting(AppConstants.STIntroduce, setting.Introduce); //SettingsService.SetSetting(AppConstants.STGreeting, setting.Greeting); //SettingsService.SetSetting(AppConstants.STFanpage, setting.Fanpage); //SettingsService.SetSetting(AppConstants.STFanChat, setting.FanChat); //SettingsService.SetSetting(AppConstants.STHotline, setting.Hotline); //SettingsService.SetSetting(AppConstants.STHotlineImg, setting.HotlineImg); SettingsService.SetSetting(AppConstants.STBankID, setting.BankID); SettingsService.SetSetting(AppConstants.STBankName, setting.BankName); SettingsService.SetSetting(AppConstants.STBankUser, setting.BankUser); if (setting.Addrens != null) { int count = setting.Addrens.Count; SettingsService.SetSetting(AppConstants.STShowroomCount, count.ToString()); for (int i = 0; i < count; i++) { SettingsService.SetSetting("Showroom[" + i + "].Address", setting.Addrens[i].Addren); SettingsService.SetSetting("Showroom[" + i + "].iFrameMap", setting.Addrens[i].iFrameMap); SettingsService.SetSetting("Showroom[" + i + "].Tel", setting.Addrens[i].Tel); SettingsService.SetSetting("Showroom[" + i + "].Hotline", setting.Addrens[i].Hotline); SettingsService.SetSetting("Showroom[" + i + "].Name", setting.Addrens[i].Name); } } else { SettingsService.SetSetting(AppConstants.STShowroomCount, "0"); setting.Addrens = new List <AdminShowroomSettingViewModel>(); } unitOfWork.Commit(); TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel { Message = LocalizationService.GetResourceString("Cập nhật thành công!"), MessageType = GenericMessages.success }; } catch (Exception ex) { unitOfWork.Rollback(); LoggingService.Error(ex); } } } return(View(setting)); }
public ActionResult Business() { var model = new AdminBusinessSettingViewModel { BusinessName = SettingsService.GetSetting(AppConstants.STBusinessName), RepresentAtive = SettingsService.GetSetting(AppConstants.STRepresentAtive), RepresentPosition = SettingsService.GetSetting(AppConstants.STRepresentPosition), Introduce = SettingsService.GetSetting(AppConstants.STIntroduce), Greeting = SettingsService.GetSetting(AppConstants.STGreeting), //Fanpage = SettingsService.GetSetting(AppConstants.STFanpage), //FanChat = SettingsService.GetSetting(AppConstants.STFanChat), //Hotline = SettingsService.GetSetting(AppConstants.STHotline), //HotlineImg = SettingsService.GetSetting(AppConstants.STHotlineImg), Addrens = new List <AdminShowroomSettingViewModel>(), BankID = SettingsService.GetSetting(AppConstants.STBankID), BankName = SettingsService.GetSetting(AppConstants.STBankName), BankUser = SettingsService.GetSetting(AppConstants.STBankUser), BankPay = SettingsService.GetSetting(AppConstants.STBankPay), }; var ShowroomCount = SettingsService.GetSetting(AppConstants.STShowroomCount); int count = 0; try { count = int.Parse(ShowroomCount); } catch { } for (int i = 0; i < count; i++) { model.Addrens.Add(new AdminShowroomSettingViewModel { Addren = SettingsService.GetSetting("Showroom[" + i + "].Address"), iFrameMap = SettingsService.GetSetting("Showroom[" + i + "].iFrameMap"), Tel = SettingsService.GetSetting("Showroom[" + i + "].Tel"), Hotline = SettingsService.GetSetting("Showroom[" + i + "].Hotline"), Name = SettingsService.GetSetting("Showroom[" + i + "].Name"), }); } return(View(model)); }
public ActionResult Business() { var model = new AdminBusinessSettingViewModel { BusinessName = SettingsService.GetSetting("BusinessName"), Introduce = SettingsService.GetSetting("Introduce"), Greeting = SettingsService.GetSetting("Greeting"), Fanpage = SettingsService.GetSetting("Fanpage"), Hotline = SettingsService.GetSetting("Hotline"), HotlineImg = SettingsService.GetSetting("HotlineImg"), Addrens = new List <AdminShowroomSettingViewModel>(), BankID = SettingsService.GetSetting("BankID"), BankName = SettingsService.GetSetting("BankName"), BankUser = SettingsService.GetSetting("BankUser"), }; var ShowroomCount = SettingsService.GetSetting("ShowroomCount"); int count = 0; try { count = int.Parse(ShowroomCount); } catch { } for (int i = 0; i < count; i++) { model.Addrens.Add(new AdminShowroomSettingViewModel { Addren = SettingsService.GetSetting("Showroom[" + i + "].Address"), iFrameMap = SettingsService.GetSetting("Showroom[" + i + "].iFrameMap"), }); } return(View(model)); }