public ActionResult Edit() { var shop = _shopService.GetById(_currentUser.Shop.Id); var shopEditForm = ShopEditForm.FromShop(shop); return(View(shopEditForm)); }
private void EditShopBtn(object sender, RoutedEventArgs e) { if (ShopListBox.SelectedItem == null) { MessageBox.Show("Магазин не выбран", "Внимание", MessageBoxButton.OK, MessageBoxImage.Error); return; } ShopEditForm shopEditForm = new ShopEditForm((Shop)ShopListBox.SelectedItem); shopEditForm.ShowDialog(); ShopListBox.ItemsSource = null; ShopListBox.ItemsSource = DBHelper.GetContext().Shop.ToList(); }
public ActionResult Edit(ShopEditForm shopEditForm) { if (!ModelState.IsValid) { return(View(shopEditForm)); } shopEditForm.Id = _currentUser.Shop.Id; shopEditForm.Name = _currentUser.Shop.Name; _shopService.Edit(shopEditForm.ToShop()); return(RedirectToAction("Index", "Purchase").WithSuccess("Perfíl Actualizado")); }