示例#1
0
        public ActionResult Create()
        {
            var model = new ShippingMethodEditViewModel();

            ViewBag.ShippingZoneId = new SelectList(shippingZoneService.FindAll().ToList(), "Id", "Name");

            return(View(model));
        }
示例#2
0
 public ShippingZoneViewModelValidator(IShippingZoneService shippingZoneService)
 {
     RuleFor(z => z.Name).NotEmpty();
     RuleFor(z => z).Must(
         z => !shippingZoneService.FindAll().Any(d => d.Id != z.Id && d.Name == z.Name))
     .WithName("Name")
     .WithMessage("Name is already used".TA());
 }
示例#3
0
        public ActionResult Index()
        {
            var model = new List <ShippingZoneIndexViewModel>();
            List <ShippingZone> shippingZones = shippingZoneService.FindAll().ToList();

            foreach (ShippingZone zone in shippingZones)
            {
                var zoneView = Mapper.Map <ShippingZoneIndexViewModel>(zone);

                model.Add(zoneView);
            }
            return(View(model));
        }