правки 2
This commit is contained in:
parent
cf3e7bd678
commit
7b7a95beb2
@ -1,16 +1,18 @@
|
||||
public class Storage
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public double StockMetrage { get; private set; }
|
||||
public int FabricId { get; private set; }
|
||||
public double StockMetrage { get; private set; }
|
||||
|
||||
|
||||
public static Storage CreateOperation(int id, double stockMetrage, int fabricId)
|
||||
public static Storage CreateOperation(int id, int fabricId, double stockMetrage)
|
||||
{
|
||||
return new Storage
|
||||
{
|
||||
Id = id,
|
||||
StockMetrage = stockMetrage,
|
||||
FabricId = fabricId
|
||||
FabricId = fabricId,
|
||||
StockMetrage = stockMetrage
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
public interface IStorageRepository
|
||||
{
|
||||
IEnumerable<Storage> ReadStorage(double? minStockMetrage = null, double? maxStockMetrage = null, int? fabricId = null);
|
||||
IEnumerable<Storage> ReadStorage(int? fabricId = null, double ? StockMetrage = null, double? maxStockMetrage = null);
|
||||
void CreateStorage(Storage storage);
|
||||
void DeleteStorage(int id);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ internal class StorageRepository : IStorageRepository
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"
|
||||
INSERT INTO Storages (StockMetrage, FabricId)
|
||||
VALUES (@StockMetrage, @FabricId)";
|
||||
INSERT INTO Storages (FabricId, StockMetrage)
|
||||
VALUES (@FabricId, @StockMetrage)";
|
||||
connection.Execute(queryInsert, storage);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -52,7 +52,7 @@ WHERE Id=@id";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public IEnumerable<Storage> ReadStorage(double? minStockMetrage = null, double? maxStockMetrage = null, int? fabricId = null)
|
||||
public IEnumerable<Storage> ReadStorage(int? fabricId = null, double ? minStockMetrage = null, double? StockMetrage = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
|
Loading…
x
Reference in New Issue
Block a user