public ActionResult Update(string encryptId) { OrderFullViewModel model = new OrderFullViewModel(); int id = !string.IsNullOrEmpty(encryptId) ? EncryptUtility.DecryptId(encryptId) : 0; //List<EnumInfo> listOrderType = GetEnumValuesAndDescriptions<OrderTypeEnum>(); //List<EnumInfo> listSourceType = GetEnumValuesAndDescriptions<SourceTypeEnum>(); List <OrderDetailViewModel> listOrderDetail = new List <OrderDetailViewModel>(); int totalRow = 0; List <Product> listProduct = (List <Product>)_productBo.GetList("", out totalRow); if (listProduct != null && listProduct.Count > 0) { foreach (Product product in listProduct) { OrderDetailViewModel orderDetailViewModel = new OrderDetailViewModel(product); listOrderDetail.Add(orderDetailViewModel); } } if (id > 0) { model = _orderBo.GetByFullValueById(id); model.lstOrderDetailViewModel = listOrderDetail; model.ListProductViewModel = _orderBo.GetByOrderId(id).ToList(); model.ListDistrict = (List <District>)_districtBoCached.GetAll(); model.ListWard = (List <Ward>)_wardBoCached.GetByDistrictId(model.DistrictId); if (model.DeliverDate == DateTime.MinValue) { model.DeliverDate = DateTime.Now; } else { } model.DeliverDateStr = model.DeliverDate.ToString("dd/MM/yyyy HH:mm"); ViewBag.Title = "Sửa đơn hàng"; } else { var result = new Order(); List <District> listDistrict = (List <District>)_districtBoCached.GetAll(); List <Ward> listWard = new List <Ward>(); model = new DVG.WIS.PublicModel.OrderFullViewModel(result, new District(), new Ward(), listOrderDetail); model.ListDistrict = listDistrict; //model.ListOrderType = listOrderType; model.DeliverDate = DateTime.Now; model.DeliverDateStr = DateTime.Now.ToString("dd/MM/yyyy HH:mm"); model.ListProductViewModel = new List <OrderDetailViewModel>(); model.OrderType = -1; model.SourceType = -1; ViewBag.Title = "Tạo đơn hàng"; } model.ProductViewModelItem = new OrderDetailViewModel(); model.CityCode = "SG"; return(View(model)); }
public ActionResult SearchByDistrictId(int districtId) { List <Ward> list = (List <Ward>)_wardBoCached.GetByDistrictId(districtId); ResponseData response = new ResponseData(); response.Success = true; response.Data = list; return(Json(response)); }
public ActionResult SearchByDistrictId(int districtId) { List <Ward> list = (List <Ward>)_wardBoCached.GetByDistrictId(districtId); ResponseData response = new ResponseData(); Msg.Error = false; Msg.Obj = list; return(AuthorizeJson(Msg)); }