diff --git a/LawFim/LawFirmExecutorApp/APIClient.cs b/LawFim/LawFirmExecutorApp/APIClient.cs new file mode 100644 index 0000000..3868c09 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/APIClient.cs @@ -0,0 +1,43 @@ +using LawFirmContracts.ViewModels; +using Newtonsoft.Json; +using System.Net.Http.Headers; +using System.Text; + +namespace LawFirmExecutorApp +{ + public class APIClient + { + private static readonly HttpClient _client = new(); + public static ExecutorViewModel? Executor { get; set; } = null; + public static void Connect(IConfiguration configuration) + { + _client.BaseAddress = new Uri(configuration["IPAddress"]); + _client.DefaultRequestHeaders.Accept.Clear(); + _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + } + public static T? GetRequest(string requestUrl) + { + var response = _client.GetAsync(requestUrl); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (response.Result.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject(result); + } + else + { + throw new Exception(result); + } + } + public static void PostRequest(string requestUrl, T model) + { + var json = JsonConvert.SerializeObject(model); + var data = new StringContent(json, Encoding.UTF8, "application/json"); + var response = _client.PostAsync(requestUrl, data); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (!response.Result.IsSuccessStatusCode) + { + throw new Exception(result); + } + } + } +} diff --git a/LawFim/LawFirmExecutorApp/Controllers/CaseController.cs b/LawFim/LawFirmExecutorApp/Controllers/CaseController.cs new file mode 100644 index 0000000..9c89475 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Controllers/CaseController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmExecutorApp.Controllers +{ + public class CaseController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/LawFim/LawFirmExecutorApp/Controllers/ClientController.cs b/LawFim/LawFirmExecutorApp/Controllers/ClientController.cs new file mode 100644 index 0000000..beb7d40 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Controllers/ClientController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmExecutorApp.Controllers +{ + public class ClientController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/LawFim/LawFirmExecutorApp/Controllers/VizitController.cs b/LawFim/LawFirmExecutorApp/Controllers/VizitController.cs new file mode 100644 index 0000000..6392640 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Controllers/VizitController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmExecutorApp.Controllers +{ + public class VizitController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/LawFim/LawFirmExecutorApp/LawFirmExecutorApp.csproj b/LawFim/LawFirmExecutorApp/LawFirmExecutorApp.csproj index c78c9c7..5dd4a85 100644 --- a/LawFim/LawFirmExecutorApp/LawFirmExecutorApp.csproj +++ b/LawFim/LawFirmExecutorApp/LawFirmExecutorApp.csproj @@ -6,4 +6,13 @@ enable + + + + + + + + + diff --git a/LawFim/LawFirmExecutorApp/Program.cs b/LawFim/LawFirmExecutorApp/Program.cs index 0727468..08bf94c 100644 --- a/LawFim/LawFirmExecutorApp/Program.cs +++ b/LawFim/LawFirmExecutorApp/Program.cs @@ -1,9 +1,20 @@ +using LawFirmExecutorApp; +using LawFirmContracts.BindingModels; +using LawFirmContracts.StoragesContracts; +using LawFirmContracts.ViewModels; +using LawFirmDatabaseImplement.Implements; +using LawFimDataModels.Models; + var builder = WebApplication.CreateBuilder(args); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); // Add services to the container. builder.Services.AddControllersWithViews(); var app = builder.Build(); +APIClient.Connect(builder.Configuration); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) diff --git a/LawFim/LawFirmExecutorApp/Views/Case/AddClient.cshtml b/LawFim/LawFirmExecutorApp/Views/Case/AddClient.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Case/AddClient.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Case/CaseClients.cshtml b/LawFim/LawFirmExecutorApp/Views/Case/CaseClients.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Case/CaseClients.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Case/CreateCase.cshtml b/LawFim/LawFirmExecutorApp/Views/Case/CreateCase.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Case/CreateCase.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Case/UpdateCase.cshtml b/LawFim/LawFirmExecutorApp/Views/Case/UpdateCase.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Case/UpdateCase.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Client/CreateClient.cshtml b/LawFim/LawFirmExecutorApp/Views/Client/CreateClient.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Client/CreateClient.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Client/UpdateClient.cshtml b/LawFim/LawFirmExecutorApp/Views/Client/UpdateClient.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Client/UpdateClient.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Home/Cases.cshtml b/LawFim/LawFirmExecutorApp/Views/Home/Cases.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Home/Cases.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Home/Clients.cshtml b/LawFim/LawFirmExecutorApp/Views/Home/Clients.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Home/Clients.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Home/Enter.cshtml b/LawFim/LawFirmExecutorApp/Views/Home/Enter.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Home/Enter.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Home/Register.cshtml b/LawFim/LawFirmExecutorApp/Views/Home/Register.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Home/Register.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Home/Visits.cshtml b/LawFim/LawFirmExecutorApp/Views/Home/Visits.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Home/Visits.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Visit/AddClient.cshtml b/LawFim/LawFirmExecutorApp/Views/Visit/AddClient.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Visit/AddClient.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Visit/CreateVisit.cshtml b/LawFim/LawFirmExecutorApp/Views/Visit/CreateVisit.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Visit/CreateVisit.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Visit/UpdateVisit.cshtml b/LawFim/LawFirmExecutorApp/Views/Visit/UpdateVisit.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Visit/UpdateVisit.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/Views/Visit/VisitClients.cshtml b/LawFim/LawFirmExecutorApp/Views/Visit/VisitClients.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/LawFim/LawFirmExecutorApp/Views/Visit/VisitClients.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/LawFim/LawFirmExecutorApp/appsettings.json b/LawFim/LawFirmExecutorApp/appsettings.json index 10f68b8..2df5a71 100644 --- a/LawFim/LawFirmExecutorApp/appsettings.json +++ b/LawFim/LawFirmExecutorApp/appsettings.json @@ -5,5 +5,6 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "IPAddress": "http://localhost:5223/" } diff --git a/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj b/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj index c78c9c7..b708084 100644 --- a/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj +++ b/LawFim/LawFirmGuarantorApp/LawFirmGuarantorApp.csproj @@ -6,4 +6,9 @@ enable + + + + +