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/OpRuleEditViewModel.cs

75 lines
2.2 KiB
C#

3 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
{
public class OpRuleEditViewModel
{
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 CompareType { get; set; }
public List<OpRuleItemEditViewModel> Items { get; set; }
}
public class OpRuleItemEditViewModel
{
public string Field { get; set; }
public string Compare { get; set; }
public string Value { get; set; }
}
public static class OpRuleEditViewModelExt
{
public static OpRule AsModel(this OpRuleEditViewModel src)
{
return Mapper.Map<OpRule>(src);
}
public static OpRule AsModel(this OpRuleEditViewModel src, OpRule dest)
{
return Mapper.Map(src, dest);
}
public static OpRuleEditViewModel AsEditViewModel(this OpRule src)
{
return Mapper.Map<OpRuleEditViewModel>(src);
}
}
public static class OpRuleItemEditViewModelExt
{
public static OpRuleItem AsModel(this OpRuleItemEditViewModel src)
{
return Mapper.Map<OpRuleItem>(src);
}
public static OpRuleItem AsModel(this OpRuleItemEditViewModel src, OpRuleItem dest)
{
return Mapper.Map(src, dest);
}
public static List<OpRuleItem> AsModelList(this IEnumerable<OpRuleItemEditViewModel> src)
{
return Mapper.Map<IEnumerable<OpRuleItemEditViewModel>, List<OpRuleItem>>(src);
}
public static OpRuleItemEditViewModel AsEditViewModel(this OpRuleItem src)
{
return Mapper.Map<OpRuleItemEditViewModel>(src);
}
public static List<OpRuleItemEditViewModel> AsEditViewModelList(this IEnumerable<OpRuleItem> src)
{
return Mapper.Map<IEnumerable<OpRuleItem>, List<OpRuleItemEditViewModel>>(src);
}
}
}