Skip to content

Commit 2723106

Browse files
Merge branch 'main' of https://github.com/IgniteUI/NorthwindAPI into dgdimitrov/enums-as-strings
2 parents 2904334 + 7190a8e commit 2723106

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+119
-163
lines changed

NorthwindCRUD.Tests/CategroyServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void ShouldUpdateCategory()
2828

2929
createdCategory.Name = "Updated Category";
3030
createdCategory.Description = "Updated Description";
31-
var updatedCategory = DataHelper.CategoryService.Update(createdCategory);
31+
var updatedCategory = DataHelper.CategoryService.Update(createdCategory.CategoryId, createdCategory);
3232

3333
Assert.IsNotNull(updatedCategory);
3434
updatedCategory = DataHelper2.CategoryService.GetById(updatedCategory.CategoryId);

NorthwindCRUD.Tests/EmployeeServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void ShouldUpdateEmployee()
2929
var createdEmployee = DataHelper.EmployeeService.Create(employee);
3030

3131
createdEmployee.Title = "Director";
32-
var updatedEmployee = DataHelper.EmployeeService.Update(createdEmployee);
32+
var updatedEmployee = DataHelper.EmployeeService.Update(createdEmployee.EmployeeId, createdEmployee);
3333

3434
Assert.IsNotNull(updatedEmployee);
3535
updatedEmployee = DataHelper2.EmployeeService.GetById(updatedEmployee.EmployeeId);

NorthwindCRUD.Tests/OrderServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void ShouldUpdateOrder()
3737
order.CustomerId = DataHelper.CreateCustomer().CustomerId;
3838
order.EmployeeId = DataHelper.CreateEmployee().EmployeeId;
3939

40-
var updatedOrder = DataHelper.OrderService.Update(order);
40+
var updatedOrder = DataHelper.OrderService.Update(order.OrderId, order);
4141

4242
Assert.IsNotNull(updatedOrder);
4343
updatedOrder = DataHelper2.OrderService.GetById(updatedOrder.OrderId);

NorthwindCRUD.Tests/ProductServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void ShouldUpdateProduct()
2727
createdProduct.UnitPrice = 15;
2828
createdProduct.UnitsInStock = 50;
2929

30-
var updatedProduct = DataHelper.ProductService.Update(createdProduct);
30+
var updatedProduct = DataHelper.ProductService.Update(createdProduct.ProductId, createdProduct);
3131

3232
Assert.IsNotNull(updatedProduct);
3333
updatedProduct = DataHelper2.ProductService.GetById(updatedProduct.ProductId);

NorthwindCRUD.Tests/RegionServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void ShouldUpdateRegion()
2727
string originalRegionDescription = region.RegionDescription;
2828
region.RegionDescription = "Updated Region";
2929

30-
var updatedRegion = DataHelper.RegionService.Update(region);
30+
var updatedRegion = DataHelper.RegionService.Update(region.RegionId, region);
3131

3232
Assert.IsNotNull(updatedRegion);
3333
updatedRegion = DataHelper2.RegionService.GetById(updatedRegion.RegionId);

NorthwindCRUD.Tests/ShipperServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void ShouldUpdateShipper()
3131
shipper.CompanyName = "Updated shipper company";
3232
shipper.Phone = "555-555-5555";
3333

34-
var updatedShipper = DataHelper.ShipperService.Update(shipper);
34+
var updatedShipper = DataHelper.ShipperService.Update(shipper.ShipperId, shipper);
3535

3636
Assert.IsNotNull(updatedShipper);
3737
updatedShipper = DataHelper2.ShipperService.GetById(updatedShipper.ShipperId);

NorthwindCRUD.Tests/SupplierServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void ShouldUpdateSupplier()
3434
supplier.ContactName = "Updated Contact";
3535
supplier.ContactTitle = "Updated Title";
3636

37-
var updatedSupplier = DataHelper.SupplierService.Update(supplier);
37+
var updatedSupplier = DataHelper.SupplierService.Update(supplier.SupplierId, supplier);
3838
Assert.IsNotNull(updatedSupplier);
3939
updatedSupplier = DataHelper2.SupplierService.GetById(updatedSupplier.SupplierId);
4040
Assert.IsNotNull(updatedSupplier);

NorthwindCRUD.Tests/TerritoryServiceFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void ShouldUpdateTerritory()
2929

3030
createdTerritory.TerritoryDescription = "Updated Territory";
3131

32-
var updatedTerritory = DataHelper.TerritoryService.Update(createdTerritory);
32+
var updatedTerritory = DataHelper.TerritoryService.Update(createdTerritory.TerritoryId, createdTerritory);
3333

3434
Assert.IsNotNull(updatedTerritory);
3535
updatedTerritory = DataHelper2.TerritoryService.GetById(updatedTerritory.TerritoryId);

NorthwindCRUD/Controllers/CategoriesController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ public ActionResult<CategoryDetailsDto> Create(CategoryDto model)
198198
}
199199
}
200200

201-
[HttpPut]
201+
[HttpPut("{id}")]
202202
[Authorize]
203-
public ActionResult<CategoryDto> Update(CategoryDto model)
203+
public ActionResult<CategoryDto> Update(int id, CategoryDto model)
204204
{
205205
try
206206
{
207207
if (ModelState.IsValid)
208208
{
209209
var mappedModel = this.mapper.Map<CategoryDto, CategoryDb>(model);
210-
var category = this.categoryService.Update(mappedModel);
210+
var category = this.categoryService.Update(id, mappedModel);
211211

212212
if (category != null)
213213
{

NorthwindCRUD/Controllers/CustomersController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,16 @@ public ActionResult<CustomerDto> Create(CustomerDto model)
209209
}
210210
}
211211

212-
[HttpPut]
212+
[HttpPut("{id}")]
213213
[Authorize]
214-
public ActionResult<CustomerDto> Update(CustomerDto model)
214+
public ActionResult<CustomerDto> Update(string id, CustomerDto model)
215215
{
216216
try
217217
{
218218
if (ModelState.IsValid)
219219
{
220220
var mappedModel = this.mapper.Map<CustomerDto, CustomerDb>(model);
221-
var customer = this.customerService.Update(mappedModel);
221+
var customer = this.customerService.Update(id, mappedModel);
222222

223223
if (customer != null)
224224
{

0 commit comments

Comments
 (0)