static void UpdateItem(ProductFlat item, string name, object value) { switch (name) { case "Id": item.Id = (string)value; return; case "ProductName": item.ProductName = (string)value; return; case "Availability": item.Availability = (bool)value; return; case "ProductCategoryId": item.ProductCategoryId = (int)value; return; case "Category": if (item.CategoryItem == null) { item.CategoryItem = new ProductCategory(); } item.CategoryItem.Category = value is ProductCategoryMain ? (ProductCategoryMain)value : Enum.Parse <ProductCategoryMain>((string)value); return; case "Subcategory": if (item.CategoryItem == null) { item.CategoryItem = new ProductCategory(); } item.CategoryItem.Subcategory = (string)value; return; } }
static void UpdateItem(ProductFlat item, IDictionary <string, object> newValue) { foreach (var field in newValue) { UpdateItem(item, field.Key, field.Value); } }
public Task Add(IDictionary <string, object> newValue) { var item = new ProductFlat(); UpdateItem(item, newValue); return(_provider.Add(item)); }
public Task Remove(ProductFlat item) { return(Loader.DeleteEntity(this, item)); }
public Task Add(ProductFlat product) { return(Loader.AddEntity(this, product)); }
public Task Update(ProductFlat item, IDictionary <string, object> newValue) { return(Task.CompletedTask); }
public Task Remove(ProductFlat item) { return(_provider.Remove(item)); }