Beispiel #1
0
        public ActionResult UpdateOrderAddress(ViewModel theModel)
        {
            var _Validator = new UpdateOrderAddressValidatorDto();

            var ReturnFileName          = "";
            var _UpdateOrderAddressData = new UpdateOrderAddressDto();

            _UpdateOrderAddressData.AddressLine1  = theModel.AddressLine1;
            _UpdateOrderAddressData.Locality      = theModel.Locality;
            _UpdateOrderAddressData.Postcode      = theModel.Postcode;
            _UpdateOrderAddressData.VerserOrderID = theModel.VerserOrderID;
            _UpdateOrderAddressData.State         = theModel.State;
            ValidationResult result = _Validator.Validate(theModel);

            if (!result.IsValid)
            {
                foreach (ValidationFailure failure in result.Errors)
                {
                    ModelState.AddModelError(failure.PropertyName, failure.ErrorMessage);
                }
            }
            else
            {
                ReturnFileName = Helper.Helper.UpdateOrderAddress(_UpdateOrderAddressData);
                if (ReturnFileName != null)
                {
                    ReturnFileName = ReturnFileName.Trim('"');
                    TempData["ValidationErrors"] = ReturnFileName;
                }
            }
            return(Json(ReturnFileName, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UpdateOrderAddress(ViewModel theModel)
        {
            var _Validator = new UpdateOrderAddressValidatorDto();


            var _UpdateOrderAddressData = new UpdateOrderAddressDto();

            _UpdateOrderAddressData.AddressLine1  = theModel.AddressLine1;
            _UpdateOrderAddressData.Locality      = theModel.Locality;
            _UpdateOrderAddressData.Postcode      = theModel.Postcode;
            _UpdateOrderAddressData.VerserOrderID = theModel.VerserOrderID;
            _UpdateOrderAddressData.State         = theModel.State;
            ValidationResult result = _Validator.Validate(theModel);

            if (!result.IsValid)
            {
                foreach (ValidationFailure failure in result.Errors)
                {
                    ModelState.AddModelError(failure.PropertyName, failure.ErrorMessage);
                }
            }
            else
            {
                var ReturnFileName = Helper.Helper.UpdateOrderAddress(_UpdateOrderAddressData);
                if (ReturnFileName != null)
                {
                    ReturnFileName = ReturnFileName.Trim('"');
                    TempData["ValidationErrors"] = ReturnFileName;
                }
            }
            List <ListItemModel> ordersList = Helper.Helper.OrdersList();
            List <ListItemModel> skuList    = Helper.Helper.SKUList();

            theModel.ListItemModel = new List <SelectListItem>();
            foreach (ListItemModel item in skuList)
            {
                theModel.ListItemModel.Add(new SelectListItem {
                    Text = item.Value
                });
            }
            theModel.OrdersListItemModel = new List <SelectListItem>();
            foreach (ListItemModel item in ordersList)
            {
                theModel.OrdersListItemModel.Add(new SelectListItem {
                    Text = item.Value
                });
            }

            return(View("Index", theModel));
        }