короче сторе кипер
This commit is contained in:
parent
8aefc24b6a
commit
b626bfda7d
@ -32,6 +32,7 @@ builder.Services.AddTransient<ICommentLogic, CommentLogic>();
|
||||
//builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
||||
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
builder.Services.AddTransient<IStoreKeeperLogic, StoreKeeperLogic>();
|
||||
builder.Services.AddTransient <IMessageInfoLogic, MessageInfoLogic>();
|
||||
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
@ -53,7 +54,6 @@ if (app.Environment.IsDevelopment())
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AbstractShopRestApi v1"));
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
@ -23,7 +23,7 @@ namespace StoreKeeperClient.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/main/getpurchases?clientId={APIClient.Client.Id}"));
|
||||
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/main/getpurchases?storekeeperId={APIClient.Client.Id}"));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -47,7 +47,7 @@ namespace StoreKeeperClient.Controllers
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/client/updatedata", new StoreKeeperBindingModel
|
||||
APIClient.PostRequest("api/storekeeper/updatedata", new StoreKeeperBindingModel
|
||||
{
|
||||
Id = APIClient.Client.Id,
|
||||
Name = fio,
|
||||
@ -66,13 +66,44 @@ namespace StoreKeeperClient.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите почту и пароль");
|
||||
}
|
||||
APIClient.Client = APIClient.GetRequest<StoreKeeperViewModel>($"api/storekeeper/login?login={login}&password={password}");
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверные почта и/или пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
return;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string name, string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин, name, пароль");
|
||||
}
|
||||
APIClient.PostRequest("api/storekeeper/register", new StoreKeeperBindingModel
|
||||
{
|
||||
Name = name,
|
||||
Login = login,
|
||||
Password = password,
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult AddBuildToPurchase()
|
||||
{
|
||||
@ -239,7 +270,7 @@ namespace StoreKeeperClient.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
||||
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/storekeeper/getmessages?storekeeperId={APIClient.Client.Id}"));
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
|
@ -7,7 +7,7 @@
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8"><input type="text" name="storeKeeperName" /></div>
|
||||
<div class="col-8"><input type="text" name="name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
|
Loading…
Reference in New Issue
Block a user