public async Task <IActionResult> Create() { var model = new ShippingPointModel(); await PrepareShippingPointModel(model); return(View(model)); }
public async Task <IActionResult> Create() { var model = new ShippingPointModel(); await PrepareShippingPointModel(model); return(View("~/Plugins/Shipping.ShippingPoint/Views/Create.cshtml", model)); }
public IActionResult Edit(ShippingPointModel model) { if (ModelState.IsValid) { var shippingPoint = _shippingPointService.GetStoreShippingPointById(model.Id); shippingPoint = model.ToEntity(); _shippingPointService.UpdateStoreShippingPoint(shippingPoint); } ViewBag.RefreshPage = true; PrepareShippingPointModel(model); return(View("~/Plugins/Shipping.ShippingPoint/Views/Edit.cshtml", model)); }
public IActionResult Create(ShippingPointModel model) { if (ModelState.IsValid) { var shippingPoint = model.ToEntity(); _shippingPointService.InsertStoreShippingPoint(shippingPoint); ViewBag.RefreshPage = true; } PrepareShippingPointModel(model); return(View("~/Plugins/Shipping.ShippingPoint/Views/Create.cshtml", model)); }
public async Task <IActionResult> Create(ShippingPointModel model) { if (ModelState.IsValid) { var shippingPoint = model.ToEntity(); await _shippingPointService.InsertStoreShippingPoint(shippingPoint); ViewBag.RefreshPage = true; } await PrepareShippingPointModel(model); return(View(model)); }
public async Task <IActionResult> Edit(ShippingPointModel model) { if (ModelState.IsValid) { var shippingPoint = await _shippingPointService.GetStoreShippingPointById(model.Id); shippingPoint = model.ToEntity(); await _shippingPointService.UpdateStoreShippingPoint(shippingPoint); } ViewBag.RefreshPage = true; await PrepareShippingPointModel(model); return(View(model)); }
private ShippingPointModel PrepareShippingPointModel(ShippingPointModel model) { model.AvailableCountries.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Address.SelectCountry"), Value = string.Empty }); foreach (var country in _countryService.GetAllCountries(showHidden: true)) { model.AvailableCountries.Add(new SelectListItem { Text = country.Name, Value = country.Id.ToString() }); } model.AvailableStores.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Configuration.Settings.StoreScope.AllStores"), Value = string.Empty }); foreach (var store in _storeService.GetAllStores()) { model.AvailableStores.Add(new SelectListItem { Text = store.Name, Value = store.Id.ToString() }); } return(model); }
private async Task <ShippingPointModel> PrepareShippingPointModel(ShippingPointModel model) { model.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = string.Empty }); foreach (var country in await _countryService.GetAllCountries(showHidden: true)) { model.AvailableCountries.Add(new SelectListItem { Text = country.Name, Value = country.Id.ToString() }); } model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Settings.StoreScope.AllStores"), Value = string.Empty }); foreach (var store in await _storeService.GetAllStores()) { model.AvailableStores.Add(new SelectListItem { Text = store.Shortcut, Value = store.Id.ToString() }); } return(model); }
public ActionResult Create() { var model = new ShippingPointModel(); return(View("~/Plugins/Shipping.ShippingPoint/Views/Create.cshtml", PrepareShippingPointModel(model))); }
public static ShippingPoints ToEntity(this ShippingPointModel model, ShippingPoints destination) { return(model.MapTo(destination)); }
public static ShippingPoints ToEntity(this ShippingPointModel model) { return(model.MapTo <ShippingPointModel, ShippingPoints>()); }