public ActionResult FaHuo(Guid id) { Goods_Order_BLL bll = new Goods_Order_BLL(); Goods_Order order = bll.Get(a => a.OrderID == id); AutoMapper.Mapper.CreateMap <Goods_Order, Goods_Order_FaHuo_ViewModel>() .ForMember(dest => dest.UserName, opt => opt.MapFrom(src => src.Users.UserName)) .ForMember(dest => dest.CategoryName, opt => opt.MapFrom(src => src.Goods.Goods_Category.CategoryName)) .ForMember(dest => dest.GoodsName, opt => opt.MapFrom(src => src.Goods.GoodName)) .ForMember(dest => dest.GoodsImage, opt => opt.MapFrom(src => src.Goods.Image)) .ForMember(dest => dest.SendWayName, opt => opt.MapFrom(src => src.Goods.Goods_SendWay.SendWayName)); Goods_Order_FaHuo_ViewModel model = AutoMapper.Mapper.Map <Goods_Order_FaHuo_ViewModel>(order); return(View(model)); }
public ActionResult FaHuo(Goods_Order_FaHuo_ViewModel model) { Goods_Order_BLL bll = new Goods_Order_BLL(); Goods_Order order = bll.Get(a => a.OrderID == model.OrderID); if (model.CategoryName == "实物商品") { if (model.SendWayName == "快递到付" || model.SendWayName == "商家包邮") { order.ExpressCompany = model.ExpressCompany; order.ExpressNumber = model.ExpressNumber; } } order.State = "已发货"; bll.Update(order); return(RedirectToAction("List", new { accountid = order.AccountID })); }