public ProductEditorViewModel Edit() { var editor = new ProductEditorViewModel(this.Id); editor.Currency = this.UnitPrice.CurrencyCode; editor.Name = this.Name; editor.Price = this.UnitPrice.Amount.ToString("F"); return editor; }
public ProductEditorViewModel Edit() { var editor = new ProductEditorViewModel(this.Id); editor.Currency = this.UnitPrice.CurrencyCode; editor.Name = this.Name; editor.Price = this.UnitPrice.Amount.ToString("F"); return(editor); }
private void InsertProduct(object parameter) { var editor = new ProductEditorViewModel(0); editor.Title = "Add Product"; editor.Currency = "DKK"; if (this.window.CreateChild(editor).ShowDialog() ?? false) { this.agent.InsertProduct(editor); this.Refresh(new object()); } }
public void UpdateProduct(ProductEditorViewModel product) { if (product == null) { throw new ArgumentNullException("product"); } using (var channel = this.factory.CreateChannel()) { var pc = this.mapper.Map(product); channel.UpdateProduct(pc); } }
public void UpdateProduct(ProductEditorViewModel product) { this.breaker.Guard(); try { this.innerAgent.UpdateProduct(product); this.breaker.Succeed(); } catch (Exception e) { this.breaker.Trip(e); throw; } }
public void UpdateProduct(ProductEditorViewModel product) { try { this.innerAgent.UpdateProduct(product); } catch (CommunicationException e) { this.AlertUser(e.Message); } catch (InvalidOperationException e) { this.AlertUser(e.Message); } }
public ProductContract Map(ProductEditorViewModel productEditorViewModel) { if (productEditorViewModel == null) { throw new ArgumentNullException("productEditorViewModel"); } var pc = new ProductContract(); pc.Id = productEditorViewModel.Id; pc.Name = productEditorViewModel.Name; pc.UnitPrice = new MoneyContract { Amount = decimal.Parse(productEditorViewModel.Price), CurrencyCode = productEditorViewModel.Currency }; return pc; }