diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.Designer.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240829021006_Mig.Designer.cs
similarity index 99%
rename from BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.Designer.cs
rename to BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240829021006_Mig.Designer.cs
index 32bd963..2f4b919 100644
--- a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.Designer.cs
+++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240829021006_Mig.Designer.cs
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace BeautyStudioDatabaseImplement.Migrations
{
[DbContext(typeof(BeautyStudioDatabase))]
- [Migration("20240828201810_ThirdMig")]
- partial class ThirdMig
+ [Migration("20240829021006_Mig")]
+ partial class Mig
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240829021006_Mig.cs
similarity index 99%
rename from BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.cs
rename to BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240829021006_Mig.cs
index 10386b7..0ed403f 100644
--- a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.cs
+++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240829021006_Mig.cs
@@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace BeautyStudioDatabaseImplement.Migrations
{
///
- public partial class ThirdMig : Migration
+ public partial class Mig : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs
index a95cfa2..5acf53f 100644
--- a/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs
+++ b/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs
@@ -55,7 +55,7 @@ namespace BeautyStudioDatabaseImplement.Models
Id = Id,
TimeSpent = TimeSpent,
Difficulty = Difficulty,
- StoreKeeperId = StoreKeeper.Id
+ StoreKeeperId = StoreKeeperId
};
}
diff --git a/BeautyStudio/BeautyStudioRestAPI/Controllers/CosmeticController.cs b/BeautyStudio/BeautyStudioRestAPI/Controllers/CosmeticController.cs
index febfa95..103728d 100644
--- a/BeautyStudio/BeautyStudioRestAPI/Controllers/CosmeticController.cs
+++ b/BeautyStudio/BeautyStudioRestAPI/Controllers/CosmeticController.cs
@@ -90,7 +90,7 @@ namespace BeautyStudioRestAPI.Controllers
}
}
- [HttpPost]
+ [HttpDelete]
public void Delete(CosmeticBindingModel model)
{
try
diff --git a/BeautyStudio/BeautyStudioRestAPI/Controllers/LaborCostController.cs b/BeautyStudio/BeautyStudioRestAPI/Controllers/LaborCostController.cs
index b1ab6b3..e892fee 100644
--- a/BeautyStudio/BeautyStudioRestAPI/Controllers/LaborCostController.cs
+++ b/BeautyStudio/BeautyStudioRestAPI/Controllers/LaborCostController.cs
@@ -104,7 +104,7 @@ namespace BeautyStudioRestAPI.Controllers
}
}
- [HttpPost]
+ [HttpDelete]
public void Delete(LaborCostBindingModel model)
{
try
diff --git a/BeautyStudio/BeautyStudioRestAPI/Controllers/OrderController.cs b/BeautyStudio/BeautyStudioRestAPI/Controllers/OrderController.cs
index 4507713..5ace5a0 100644
--- a/BeautyStudio/BeautyStudioRestAPI/Controllers/OrderController.cs
+++ b/BeautyStudio/BeautyStudioRestAPI/Controllers/OrderController.cs
@@ -104,7 +104,7 @@ namespace BeautyStudioRestAPI.Controllers
}
}
- [HttpPost]
+ [HttpDelete]
public void Delete(OrderBindingModel model)
{
try
diff --git a/BeautyStudio/BeautyStudioRestAPI/Controllers/ProcedureController.cs b/BeautyStudio/BeautyStudioRestAPI/Controllers/ProcedureController.cs
index 447ac14..8a3619a 100644
--- a/BeautyStudio/BeautyStudioRestAPI/Controllers/ProcedureController.cs
+++ b/BeautyStudio/BeautyStudioRestAPI/Controllers/ProcedureController.cs
@@ -90,7 +90,7 @@ namespace BeautyStudioRestAPI.Controllers
}
}
- [HttpPost]
+ [HttpDelete]
public void Delete(ProcedureBindingModel model)
{
try
diff --git a/BeautyStudio/BeautyStudioRestAPI/Controllers/ServiceController.cs b/BeautyStudio/BeautyStudioRestAPI/Controllers/ServiceController.cs
index 177a631..fecbf69 100644
--- a/BeautyStudio/BeautyStudioRestAPI/Controllers/ServiceController.cs
+++ b/BeautyStudio/BeautyStudioRestAPI/Controllers/ServiceController.cs
@@ -104,7 +104,7 @@ namespace BeautyStudioRestAPI.Controllers
}
}
- [HttpPost]
+ [HttpDelete]
public void Delete(ServiceBindingModel model)
{
try
diff --git a/BeautyStudio/StoreKeeperWebApp/Controllers/CosmeticController.cs b/BeautyStudio/StoreKeeperWebApp/Controllers/CosmeticController.cs
index 34c6c73..d19dea6 100644
--- a/BeautyStudio/StoreKeeperWebApp/Controllers/CosmeticController.cs
+++ b/BeautyStudio/StoreKeeperWebApp/Controllers/CosmeticController.cs
@@ -2,6 +2,7 @@
using BeautyStudioContracts.BusinessLogicContracts;
using BeautyStudioContracts.SearchModels;
using BeautyStudioContracts.ViewModels;
+using BeautyStudioDatabaseImplement;
using BeautyStudioDatabaseImplement.Models;
using BeautyStudioDataModels.Models;
using DocumentFormat.OpenXml.Spreadsheet;
@@ -55,7 +56,7 @@ namespace StoreKeeperWebApp.Controllers
}
[HttpGet]
- public IActionResult CreateCosmetics()
+ public IActionResult CreateCosmetics(int laborCostId)
{
if (APIStoreKeeper.Storekeeper == null)
{
@@ -67,35 +68,34 @@ namespace StoreKeeperWebApp.Controllers
StoreKeeperId = APIStoreKeeper.Storekeeper.Id,
});
- return View();
+ return View();
}
- [HttpPost]
- public void CreateCosmetics(string name, double price, int laborCost)
- {
- if (APIStoreKeeper.Storekeeper == null)
- {
- throw new Exception("Необходимо авторизоваться!");
- }
+ [HttpPost]
+ public void CreateCosmetics(string name, double price, int laborCost)
+ {
+ if (APIStoreKeeper.Storekeeper == null)
+ {
+ throw new Exception("Необходимо авторизоваться!");
+ }
- if (string.IsNullOrEmpty(name) || price <= 0 || laborCost <= 0)
- {
+ if (string.IsNullOrEmpty(name) || price <= 0 || laborCost <= 0)
+ {
throw new Exception("Введены не все данные!");
- }
+ }
- cosmetic.Create(new CosmeticBindingModel
- {
- CosmeticName = name,
- CosmeticPrice = price,
- StoreKeeperId = APIStoreKeeper.Storekeeper.Id,
- LaborCostId = laborCost
- });
+ cosmetic.Create(new CosmeticBindingModel
+ {
+ CosmeticName = name,
+ CosmeticPrice = price,
+ StoreKeeperId = APIStoreKeeper.Storekeeper.Id,
+ LaborCostId = laborCost
+ });
- Response.Redirect("/Cosmetic/Cosmetics");
- }
+ Response.Redirect("/Cosmetic/Cosmetics");
+ }
-
- [HttpGet]
+ [HttpGet]
public IActionResult UpdateCosmetics(int id)
{
if (APIStoreKeeper.Storekeeper == null)
diff --git a/BeautyStudio/StoreKeeperWebApp/Controllers/LaborCostController.cs b/BeautyStudio/StoreKeeperWebApp/Controllers/LaborCostController.cs
index 5b6d8cd..bde281d 100644
--- a/BeautyStudio/StoreKeeperWebApp/Controllers/LaborCostController.cs
+++ b/BeautyStudio/StoreKeeperWebApp/Controllers/LaborCostController.cs
@@ -71,50 +71,50 @@ namespace StoreKeeperWebApp.Controllers
return View();
}
- [HttpPost]
- public void CreateLaborCosts(int hours, string difficulty, int cosmeticId)
- {
- if (APIStoreKeeper.Storekeeper == null)
- {
- throw new Exception("Необходимо авторизоваться!");
- }
-
- if (hours <= 0 || string.IsNullOrEmpty(difficulty) || cosmeticId <= 0)
- {
- throw new Exception("Введены не все данные!");
- }
-
- laborCost.Create(new LaborCostBindingModel
- {
- TimeSpent = hours,
- Difficulty = difficulty,
- StoreKeeperId = APIStoreKeeper.Storekeeper.Id
- });
-
- var labor = laborCost.ReadElement(new LaborCostSearchModel {
- TimeSpent = hours,
- Difficulty = difficulty,
- StoreKeeperId = APIStoreKeeper.Storekeeper.Id
- });
-
- var cosm = cosmetic.ReadElement(new CosmeticSearchModel{ Id = cosmeticId });
- if (cosm != null && labor != null)
+ [HttpPost]
+ public void CreateLaborCosts(int hours, string difficulty, int cosmeticId)
+ {
+ if (APIStoreKeeper.Storekeeper == null)
{
- cosm.LaborCostId = labor.Id; // Присваиваем айди трудозатраты к объекту косметики
- cosmetic.Update(new CosmeticBindingModel
- {
- Id = cosm.Id,
- CosmeticName = cosm.CosmeticName,
- CosmeticPrice = cosm.CosmeticPrice,
- LaborCostId = cosm.LaborCostId
- });
+ throw new Exception("Необходимо авторизоваться!");
}
- Response.Redirect("/LaborCost/LaborCosts");
- }
+ if (hours <= 0 || string.IsNullOrEmpty(difficulty) || cosmeticId <= 0)
+ {
+ throw new Exception("Введены не все данные!");
+ }
+ laborCost.Create(new LaborCostBindingModel
+ {
+ TimeSpent = hours,
+ Difficulty = difficulty,
+ StoreKeeperId = APIStoreKeeper.Storekeeper.Id
+ });
- [HttpGet]
+ var labor = laborCost.ReadElement(new LaborCostSearchModel
+ {
+ TimeSpent = hours,
+ Difficulty = difficulty,
+ StoreKeeperId = APIStoreKeeper.Storekeeper.Id
+ });
+
+ var cosm = cosmetic.ReadElement(new CosmeticSearchModel { Id = cosmeticId });
+ if (cosm != null && labor != null)
+ {
+ cosm.LaborCostId = labor.Id; // Присваиваем айди трудозатраты к объекту косметики
+ cosmetic.Update(new CosmeticBindingModel
+ {
+ Id = cosm.Id,
+ CosmeticName = cosm.CosmeticName,
+ CosmeticPrice = cosm.CosmeticPrice,
+ LaborCostId = cosm.LaborCostId
+ });
+ }
+
+ Response.Redirect("/LaborCost/LaborCosts");
+ }
+
+ [HttpGet]
public IActionResult UpdateLaborCosts(int id)
{
if (APIStoreKeeper.Storekeeper == null)