コード例 #1
0
        public async Task <SweetAlertExtenstion> UpdateInfo(SiteInfoUpdateViewModel vm)
        {
            var entity = await TableNoTracking.SingleOrDefaultAsync();

            if (vm.LogoFile != null)
            {
                entity.Logo = await MFile.Save(vm.LogoFile, "Uploads/SiteSetting");
            }

            if (vm.BackGroudLoginPageFile != null)
            {
                entity.BackGroudLoginPage = await MFile.Save(vm.BackGroudLoginPageFile, "Uploads/SiteSetting");
            }

            entity.SiteName = vm.SiteName;

            Entities.Update(entity);
            await DbContext.SaveChangesAsync();

            return(SweetAlertExtenstion.Ok());
        }
コード例 #2
0
 public async Task <IActionResult> EditeSiteInfo(SiteInfoUpdateViewModel siteSetting)
 {
     TempData.AddResult(await _siteSettingRepository.UpdateInfo(siteSetting));
     return(RedirectToAction("EditeSiteInfo"));
 }