forked from red-gate/web-kata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProductStore.cs
187 lines (182 loc) · 6.11 KB
/
ProductStore.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using app6.Models;
namespace app6
{
// Note: this store is not thread safe
public class ProductStore
{
public ProductStore()
{
Products = InitialStore();
}
public IEnumerable<Product> Products { get; set; }
public void AddProduct(Product p)
{
Products = Products.Append(p);
}
public void RemoveProduct(string name)
{
var products = Products.ToList();
var product = products.Where(p => p.Name.ToLower() == name.ToLower()).SingleOrDefault();
if (product != null)
{
products.Remove(product);
Products = products;
}
}
private IEnumerable<Product> InitialStore()
{
return new List<Product>()
{
{
new Product
{
Name = "SQL Compare",
Description = "Compares and synchronizes SQL Server database schemas"
}
},
{
new Product
{
Name= "SQL Data Compare",
Description = "Compares and synchronizes SQL Server database contents"
}
},
{
new Product
{
Name= "SQL Source Control",
Description = "Connect your databases to your source control system"
}
},
{
new Product
{
Name= "SQL Prompt",
Description = "Write, format, and refactor SQL effortlessly"
}
},
{
new Product
{
Name= "SQL Monitor",
Description = "Real-time SQL Server performance monitoring, with alerts and diagnostics"
}
},
{
new Product
{
Name= "DLM Automation",
Description = "Automate your database changes with CI and automated deployment"
}
},
{
new Product
{
Name= "SQL Clone",
Description = "Create SQL Server database copies in an instant",
IsNew = true
}
},
{
new Product
{
Name= "SQL Backup",
Description = "Compresses, strengthens, and encrypts backups"
}
},
{
new Product
{
Name= "DLM Dashboard",
Description = "Be the first to know when any of your database schemas change",
IsFree= true
}
},
{
new Product
{
Name= "ReadyRoll",
Description = "Migrate through schema versions with ordered scripts in Visual Studio"
}
},
{
new Product
{
Name= "SQL Search",
Description = "Search within SQL Server database schemas",
IsFree= true
}
},
{
new Product
{
Name= "SQL Doc",
Description = "Document SQL Server databases"
}
},
{
new Product
{
Name= "SQL Data Generator",
Description = "Test data generator for SQL Server databases"
}
},
{
new Product
{
Name= "SQL Test",
Description = "Unit test add-in for SQL Server Management Studio"
}
},
{
new Product
{
Name= "SQL Dependency Tracker",
Description = "Visualizes SQL Server object dependencies"
}
},
{
new Product
{
Name= "SQL Multi Script",
Description = "Deploy multiple scripts to multiple servers with one click"
}
},
{
new Product
{
Name= "SQL Scripts Manager",
Description = "Powerful, reliable, automated scripting by SQL Server experts, for the community",
IsFree= true
}
},
{
new Product
{
Name= "SQL Index Manager",
Description = "Analyze, manage, and fix database index fragmentation"
}
},
{
new Product
{
Name= "SQL Comparison SDK",
Description = "Automates comparison and synchronization tasks"
}
},
{
new Product
{
Name= "SQL Code Guard",
Description = "Find code issues in an entire SQL Server database or a query window"
}
}
};
}
}
}