You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Models/MsOpRule/OpRuleListViewModel.cs

76 lines
2.3 KiB
C#

2 years ago
using AutoMapper;
using DSWeb.Areas.MvcShipping.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace DSWeb.Areas.MvcShipping.Models.MsOpRule
{
//列表viewmodel的包装类
public class OpRuleListViewModelList
{
public int Total { get; set; }
public List<OpRuleListViewModel> List { get; set; }
}
//列表viewmodel
public class OpRuleListViewModel
{
public string GID { get; set; }
public string Code { get; set; }
public string Title { get; set; }
public string RedAlertField { get; set; }
public bool SaveDisable { get; set; }
public bool Enable { get; set; }
public string EnableDisableTime { get; set; }
}
//检查时获取列表viewmodel
public class OpRuleCheckListViewModel
{
public string Title { get; set; }
public string RedAlertField { get; set; }
public bool SaveDisable { get; set; }
public string CompareType { get; set; }
public List<OpRuleItemCheckListViewModel> Items { get; set; }
}
//检查时获取item的列表的viewmodel
public class OpRuleItemCheckListViewModel
{
public string Field { get; set; }
public string Compare { get; set; }
public string Value { get; set; }
}
//列表拓展
public static class OpRuleListViewModelExt
{
public static List<OpRuleListViewModel> AsListViewModelList(this IEnumerable<OpRule> src)
{
return Mapper.Map<IEnumerable<OpRule>, List<OpRuleListViewModel>>(src);
}
}
//检查列表拓展
public static class OpRuleCheckListViewModelExt
{
public static OpRuleCheckListViewModel AsCheckListViewModel(this OpRule src)
{
return Mapper.Map<OpRuleCheckListViewModel>(src);
}
public static List<OpRuleCheckListViewModel> AsCheckListViewModelList(this IEnumerable<OpRule> src)
{
return Mapper.Map<IEnumerable<OpRule>, List<OpRuleCheckListViewModel>>(src);
}
public static List<OpRuleItemCheckListViewModel> AsCheckListViewModelList(this IEnumerable<OpRuleItem> src)
{
return Mapper.Map<IEnumerable<OpRuleItem>, List<OpRuleItemCheckListViewModel>>(src);
}
}
}