Add new data table

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 лет назад
Hi,

I added a new data table called GoldRate (Id(int), YelloGoldRate(decimal), WhiteGoldRate(decimal)). And View Page is GoldRate. See Code below

   public ActionResult GoldRate()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
                return AccessDeniedView();

            var model = _goldrateSettings.ToModel();
            return View(model);
        }

public static GoldRateSettingsModel ToModel(this GoldRateSettings entity)
        {
            return Mapper.Map<GoldRateSettings, GoldRateSettingsModel>(entity);
        }

public class GoldRateSettings : ISettings
    {
        public int Id { get; set; }
        public decimal? YelloGoldRate { get; set; }
        public decimal? WhiteGoldRate { get; set; }

    }

public class GoldRateSettingsModel
    {
        [NopResourceDisplayName("Admin.Configuration.Settings.GoldRate.ID")]
        public int Id { get; set; }

        [NopResourceDisplayName("Admin.Configuration.Settings.GoldRate.YelloGoldRate")]
        public decimal? YelloGoldRate { get; set; }

        [NopResourceDisplayName("Admin.Configuration.Settings.GoldRate.WhiteGoldRate")]
        public decimal? WhiteGoldRate { get; set; }

      

    }

i got error in return Mapper.Map<GoldRateSettings, GoldRateSettingsModel>(entity);

"Trying to map Nop.Core.Domain.Configuration.GoldRateSettings to Nop.Admin.Models.Settings.GoldRateSettingsModel.
Exception of type 'AutoMapper.AutoMapperMappingException' was thrown."

Help need.

Thanks
12 лет назад
https://www.nopcommerce.com/boards/t/15974/almost-there.aspx
12 лет назад
Thanks, I'll check
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.