public ProductTypeWrapper createProductType() { ProductTypeWrapper product_type = new ProductTypeWrapper(new LGSA.Model.dic_Product_type()); product_type.Id = this.Id; product_type.Name = this.Name; return(product_type); }
private void OnAddExecute() { var wrapper = new ProductTypeWrapper(new ProductType()); wrapper.PropertyChanged += Wrapper_PropertyChanged; _productTypeRepository.Add(wrapper.Model); ProductTypes.Add(wrapper); // Triiger the validation wrapper.Type = ""; }
public override async Task LoadAsync(int productTypeId) { Id = productTypeId; foreach (var wrapper in ProductTypes) { wrapper.PropertyChanged -= Wrapper_PropertyChanged; } ProductTypes.Clear(); var types = await _productTypeRepository.GetAllAsync(); foreach (var model in types) { var wrapper = new ProductTypeWrapper(model); wrapper.PropertyChanged += Wrapper_PropertyChanged; ProductTypes.Add(wrapper); } }
private async void OnRemoveExecute() { var isReferenced = await _productTypeRepository.IsReferencedByProductAsync(SelectedProductType.Id); if (isReferenced) { await MessageDialogService.ShowInfoDialogAsync( $"Тип {SelectedProductType.Type} не может быть удален, т.к. связан как минимум с одним товаром"); return; } SelectedProductType.PropertyChanged -= Wrapper_PropertyChanged; _productTypeRepository.Remove(SelectedProductType.Model); ProductTypes.Remove(SelectedProductType); SelectedProductType = null; HasChanges = _productTypeRepository.HasChanges(); ((DelegateCommand)SaveCommand).RaiseCanExecuteChanged(); }
public void clear() { dic_Genre dicGenre = new dic_Genre(); dic_Product_type dicProductType = new dic_Product_type(); dic_condition dicCondition = new dic_condition(); dicGenre.name = "All/Any"; dicCondition.name = "All/Any"; dicProductType.name = "All/Any"; _productType = new ProductTypeWrapper(dicProductType); _genre = new GenreWrapper(dicGenre); _condition = new ConditionWrapper(dicCondition); _name = ""; Price = ""; _rating = ""; _stock = ""; _productOwner = null; _soldCopies = null; _id = null; _buyerId = null; _sellerId = null; _amount = null; }
public IActionResult RoundTripPost([FromBody] ProductTypeWrapper productType) { return(RoundTrip <ProductType, string>(productType.ProductType)); }