public IActionResult Edit(HomePageBasicInfoViewModel homePageBasicInfo) { if (ModelState.IsValid) { if (homePageBasicInfo.LogoFile != null) { homePageBasicInfo.LogoUrl = _fileService.UploadImageUrlNew(homePageBasicInfo.LogoFile); } if (homePageBasicInfo.FavIconFile != null) { homePageBasicInfo.FavIconUrl = _fileService.UploadImageUrlNew(homePageBasicInfo.FavIconFile); } _hP_BasicInfoReopsitory.Update(homePageBasicInfo.MapToModel()); _toastNotification.AddSuccessToastMessage(ToasrMessages.EditSuccess); return(RedirectToAction(nameof(Index))); } return(View(homePageBasicInfo)); }
public static HomePageBasicInfo MapToModel(this HomePageBasicInfoViewModel homePageBasicInfo) { return(new HomePageBasicInfo() { Id = homePageBasicInfo.Id, LogoUrl = homePageBasicInfo.LogoUrl, ApprovalDate = homePageBasicInfo.ApprovalDate, ApprovedById = homePageBasicInfo.ApprovedById, CreatedById = homePageBasicInfo.CreatedById, CreationDate = homePageBasicInfo.CreationDate, FavIconUrl = homePageBasicInfo.FavIconUrl, ModificationDate = homePageBasicInfo.ModificationDate, ModifiedById = homePageBasicInfo.ModifiedById, SeoDescriptionAR = homePageBasicInfo.SeoDescriptionAR, SeoTwitterCardEN = homePageBasicInfo.SeoTwitterCardEN, SeoTwitterCardAR = homePageBasicInfo.SeoTwitterCardAR, SeoTitleEN = homePageBasicInfo.SeoTitleEN, SeoTitleAR = homePageBasicInfo.SeoTitleAR, SeoOgTitleEN = homePageBasicInfo.SeoOgTitleEN, SeoOgTitleAR = homePageBasicInfo.SeoOgTitleAR, SeoDescriptionEN = homePageBasicInfo.SeoDescriptionEN, }); }