From 5d33fe23197332d38e32942b8b64f8a0b12682a9 Mon Sep 17 00:00:00 2001 From: Viltskaa Date: Tue, 28 Mar 2023 10:13:21 +0400 Subject: [PATCH] delete second project --- .../Controllers/ClientController.cs | 66 ---------------- .../Controllers/MainController.cs | 75 ------------------- SushiBar/SushiBarRestApi1/Program.cs | 36 --------- .../Properties/launchSettings.json | 31 -------- .../SushiBarRestApi1/SushiBarRestApi1.csproj | 20 ----- .../appsettings.Development.json | 8 -- SushiBar/SushiBarRestApi1/appsettings.json | 9 --- 7 files changed, 245 deletions(-) delete mode 100644 SushiBar/SushiBarRestApi1/Controllers/ClientController.cs delete mode 100644 SushiBar/SushiBarRestApi1/Controllers/MainController.cs delete mode 100644 SushiBar/SushiBarRestApi1/Program.cs delete mode 100644 SushiBar/SushiBarRestApi1/Properties/launchSettings.json delete mode 100644 SushiBar/SushiBarRestApi1/SushiBarRestApi1.csproj delete mode 100644 SushiBar/SushiBarRestApi1/appsettings.Development.json delete mode 100644 SushiBar/SushiBarRestApi1/appsettings.json diff --git a/SushiBar/SushiBarRestApi1/Controllers/ClientController.cs b/SushiBar/SushiBarRestApi1/Controllers/ClientController.cs deleted file mode 100644 index 76ad320..0000000 --- a/SushiBar/SushiBarRestApi1/Controllers/ClientController.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SushiBarContracts.BindingModels; -using SushiBarContracts.BusinessLogicsContracts; -using SushiBarContracts.SearchModels; -using SushiBarContracts.ViewModels; - -namespace SushiBarRestApi.Controllers; - -[Route("api/[controller]/[action]")] -[ApiController] -public class ClientController : Controller -{ - private readonly ILogger _logger; - private readonly IClientLogic _logic; - public ClientController(IClientLogic logic, ILogger logger) - { - _logger = logger; - _logic = logic; - } - - [HttpGet] - public ClientViewModel? Login(string login, string password) - { - try - { - return _logic.ReadElement(new ClientSearchModel - { - Email = login, - Password = password - }); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error on login"); - throw; - } - } - - [HttpPost] - public void Register(ClientBindingModel model) - { - try - { - _logic.Create(model); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error on registration"); - throw; - } - } - [HttpPost] - public void UpdateData(ClientBindingModel model) - { - try - { - _logic.Update(model); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error on update"); - throw; - } - } - -} \ No newline at end of file diff --git a/SushiBar/SushiBarRestApi1/Controllers/MainController.cs b/SushiBar/SushiBarRestApi1/Controllers/MainController.cs deleted file mode 100644 index e65cba3..0000000 --- a/SushiBar/SushiBarRestApi1/Controllers/MainController.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SushiBarContracts.BindingModels; -using SushiBarContracts.BusinessLogicsContracts; -using SushiBarContracts.SearchModels; -using SushiBarContracts.ViewModels; - -namespace SushiBarRestApi.Controllers; - -[Route("api/[controller]/[action]")] -[ApiController] -public class MainController : Controller -{ - private readonly ILogger _logger; - private readonly IOrderLogic _order; - private readonly ISushiLogic _sushi; - public MainController(ILogger logger, IOrderLogic order, ISushiLogic sushi) - { - _logger = logger; - _order = order; - _sushi = sushi; - } - [HttpGet] - public List? GetProductList() - { - try - { - return _sushi.ReadList(null); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error on getting list of sushi"); - throw; - } - } - [HttpGet] - public SushiViewModel? GetProduct(int sushiId) - { - try - { - return _sushi.ReadElement(new SushiSearchModel() { Id = sushiId }); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error getting sushi with id={Id}", sushiId); - throw; - } - } - [HttpGet] - public List? GetOrders(int clientId) - { - try - { - return _order.ReadList(new OrderSearchModel { ClientId = clientId - }); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error getting orders for client with id={Id}", clientId); - throw; - } - } - [HttpPost] - public void CreateOrder(OrderBindingModel model) - { - try - { - _order.CreateOrder(model); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error create order"); - throw; - } - } -} \ No newline at end of file diff --git a/SushiBar/SushiBarRestApi1/Program.cs b/SushiBar/SushiBarRestApi1/Program.cs deleted file mode 100644 index 77ac6e5..0000000 --- a/SushiBar/SushiBarRestApi1/Program.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.OpenApi.Models; -using SushiBarBusinessLogic.BusinessLogics; -using SushiBarContracts.BusinessLogicsContracts; -using SushiBarContracts.StoragesContracts; -using SushiBarDatabaseImplement.Implements; - -var builder = WebApplication.CreateBuilder(args); - -builder.Logging.SetMinimumLevel(LogLevel.Trace); - -// Add services to the container. -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); - -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "SushiBarRestApi", Version = "v1" }); }); - -var app = builder.Build(); - -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SushiBarRestApi v1")); -} - -app.UseHttpsRedirection(); -app.UseAuthorization(); -app.MapControllers(); -app.Run(); \ No newline at end of file diff --git a/SushiBar/SushiBarRestApi1/Properties/launchSettings.json b/SushiBar/SushiBarRestApi1/Properties/launchSettings.json deleted file mode 100644 index 89379ff..0000000 --- a/SushiBar/SushiBarRestApi1/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:55171", - "sslPort": 44388 - } - }, - "profiles": { - "SushiBarRestApi": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7263;http://localhost:5256", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/SushiBar/SushiBarRestApi1/SushiBarRestApi1.csproj b/SushiBar/SushiBarRestApi1/SushiBarRestApi1.csproj deleted file mode 100644 index 3ec67d7..0000000 --- a/SushiBar/SushiBarRestApi1/SushiBarRestApi1.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net6.0 - enable - enable - SushiBarRestApi - - - - - - - - - - - - - diff --git a/SushiBar/SushiBarRestApi1/appsettings.Development.json b/SushiBar/SushiBarRestApi1/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/SushiBar/SushiBarRestApi1/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/SushiBar/SushiBarRestApi1/appsettings.json b/SushiBar/SushiBarRestApi1/appsettings.json deleted file mode 100644 index 10f68b8..0000000 --- a/SushiBar/SushiBarRestApi1/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -}