private ProductTypeModel TypeToModel(ProductType type) { return new ProductTypeModel { TypeId = type.Id, Name = StringUtilities.EscapeStringForDatabase(type.Name) }; }
public async Task<long> RenameProductType(ProductType pType, string newProductTypeName) { pType.Name = newProductTypeName; var result = await DBService.SaveProductType(TypeToModel(pType)).ConfigureAwait(false); if (result > 0) { TypeUpdated(); } return result; }
public async Task<long> SaveProductType(ProductType productType) { ProductTypesCache.SetNeedRefresh(); var result = await DBService.SaveProductType(TypeToModel(productType)).ConfigureAwait(false); if (result > 0) { TypeUpdated(); } return result; }
public async Task<bool> RemoveProductType(ProductType pType) { var result = await DBService.DeleteProductType(TypeToModel(pType)).ConfigureAwait(false); if (result) { TypeUpdated(); } return result; }
private ProductTypeModel TypeToModel(ProductType type) { return(new ProductTypeModel { TypeId = type.Id, Name = StringUtilities.EscapeStringForDatabase(type.Name) }); }