Word Orders
This commit is contained in:
parent
1a5a000ef4
commit
1be107f883
@ -6,11 +6,13 @@ namespace ElectronicsShopDataBaseImplement
|
||||
{
|
||||
public class Database : DbContext
|
||||
{
|
||||
//DESKTOP-E2VPEN3
|
||||
//DESKTOP-O0N00SH
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder
|
||||
optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false) {
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-O0N00SH\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20240527175902_InitMigration")]
|
||||
partial class InitMigration
|
||||
[Migration("20240528050446_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMigration : Migration
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
@ -26,13 +26,28 @@ namespace ElectronicsShopRestAPI.Controllers {
|
||||
|
||||
[HttpGet]
|
||||
public List<ProductViewModel>? GetProductList() {
|
||||
//tdoo
|
||||
return null;
|
||||
try
|
||||
{
|
||||
return _product.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка суши");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ProductViewModel? GetProduct(int ProductID) {
|
||||
return null;
|
||||
try
|
||||
{
|
||||
return _product.ReadElement(new ProductSearchModel { ID = ProductID});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения продукта по id={Id}", ProductID);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +82,15 @@ namespace ElectronicsShopRestAPI.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
public void CreateOrder(OrderBindingModel model) {
|
||||
return;
|
||||
try
|
||||
{
|
||||
_order.CreateOrder(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
Loading…
Reference in New Issue
Block a user