forked from grandnode/grandnode2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin panel - Admin search - use automapper
- Loading branch information
1 parent
7ef1f48
commit c6e3846
Showing
3 changed files
with
38 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AdminSearchSettingsMappingExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Grand.Domain.AdminSearch; | ||
using Grand.Infrastructure.Mapper; | ||
using Grand.Web.Admin.Models.Settings; | ||
|
||
namespace Grand.Web.Admin.Extensions | ||
{ | ||
public static class AdminSearchSettingsMappingExtensions | ||
{ | ||
public static AdminSearchSettingsModel ToModel(this AdminSearchSettings entity) | ||
{ | ||
return entity.MapTo<AdminSearchSettings, AdminSearchSettingsModel>(); | ||
} | ||
public static AdminSearchSettings ToEntity(this AdminSearchSettingsModel model, AdminSearchSettings destination) | ||
{ | ||
return model.MapTo(destination); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Web/Grand.Web.Admin/Mapper/AdminSearchSettingsProfile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using AutoMapper; | ||
using Grand.Domain.AdminSearch; | ||
using Grand.Infrastructure.Mapper; | ||
using Grand.Web.Admin.Models.Settings; | ||
|
||
namespace Grand.Web.Admin.Mapper | ||
{ | ||
public class AdminSearchSettingsProfile : Profile, IAutoMapperProfile | ||
{ | ||
public AdminSearchSettingsProfile() | ||
{ | ||
CreateMap<AdminSearchSettings, AdminSearchSettingsModel>(); | ||
CreateMap<AdminSearchSettingsModel, AdminSearchSettings>(); | ||
} | ||
|
||
public int Order => 0; | ||
} | ||
} |