-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update namespaces, add DishesController and repository
Updated namespaces in multiple files from `Restaurants.Domain.Entities` to `Restaurants.Domains.Models`. Reformatted `Address` and `Dish` classes to include braces. Added `DishesController` for handling HTTP requests related to `Dish` entities. Added `DishesRepository` and `IDishesRepository` for managing `Dish` entities. Updated `Resturants.csproj` to include `Microsoft.VisualStudio.Web.CodeGeneration.Design` package.
- Loading branch information
Showing
8 changed files
with
123 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Restaurants.DataAccessor; | ||
using Restaurants.Domains.Models; | ||
|
||
namespace Resturants.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class DishesController : ControllerBase | ||
{ | ||
private readonly ResturantDbContext _context; | ||
|
||
public DishesController(ResturantDbContext context) | ||
{ | ||
_context = context; | ||
} | ||
|
||
|
||
[HttpGet] | ||
public async Task<ActionResult<IEnumerable<Dish>>> GetDishes() | ||
Check warning on line 20 in src/Controllers/DishesController.cs
|
||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
[HttpGet] | ||
[Route("{id:int}")] | ||
public async Task<ActionResult<Dish>> GetDishById(int id) | ||
Check warning on line 28 in src/Controllers/DishesController.cs
|
||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
[HttpPut] | ||
[Route("{id:int}")] | ||
public async Task<IActionResult> UpdateDish(int id, Dish dish) | ||
Check warning on line 36 in src/Controllers/DishesController.cs
|
||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
[HttpPost] | ||
public async Task<ActionResult<Dish>> PostDish(Dish dish) | ||
Check warning on line 43 in src/Controllers/DishesController.cs
|
||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
[HttpDelete] | ||
[Route("{id:int}")] | ||
public async Task<IActionResult> DeleteDish(int id) | ||
Check warning on line 51 in src/Controllers/DishesController.cs
|
||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
namespace Restaurants.Domain.Entities; | ||
|
||
public class Address | ||
namespace Restaurants.Domains.Models | ||
{ | ||
public string? City { get; set; } | ||
public string? Street { get; set; } | ||
public string? PostalCode { get; set; } | ||
} | ||
public class Address | ||
{ | ||
public string? City { get; set; } | ||
public string? Street { get; set; } | ||
public string? PostalCode { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
namespace Restaurants.Domain.Entities; | ||
|
||
public class Dish | ||
namespace Restaurants.Domains.Models | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = default!; | ||
public string Description { get; set; } = default!; | ||
public decimal Price { get; set; } | ||
public class Dish | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = default!; | ||
public string Description { get; set; } = default!; | ||
public decimal Price { get; set; } | ||
|
||
public int? KiloCalories { get; set; } | ||
public int? KiloCalories { get; set; } | ||
|
||
public int RestaurantId { get; set; } | ||
} | ||
public int RestaurantId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Restaurants.Domains.Models; | ||
using Resturants.Repository.Interfaces; | ||
|
||
namespace Resturants.Repository.Implementations | ||
{ | ||
public class DishesRepository : IDishesRepository | ||
{ | ||
public Task<Dish> AddDishAsync(Dish add_dish) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<bool> DeleteDishAsync(int id) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<Dish?> GetDishByIdAsync(int id) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<List<Dish>> GetDishesAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<bool> UpdateDishAsync(int id, Dish update_dish) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Restaurants.Domains.Models; | ||
|
||
namespace Resturants.Repository.Interfaces | ||
{ | ||
public interface IDishesRepository | ||
{ | ||
Task<List<Dish>> GetDishesAsync(); | ||
Task<Dish?> GetDishByIdAsync(int id); | ||
Task<Dish> AddDishAsync(Dish add_dish); | ||
Task<bool> DeleteDishAsync(int id); | ||
Task<bool> UpdateDishAsync(int id, Dish update_dish); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters