fix Contracts

This commit is contained in:
FLARJ 2023-05-19 14:16:33 +04:00
parent c2ed8a645e
commit 8d6846eefc
9 changed files with 23 additions and 24 deletions

View File

@ -5,7 +5,7 @@ namespace FurnitureContracts.BindingModels
public class OrdersBindingModel : IOrdersModel
{
public string Title { get; set; } = string.Empty;
public DateTime Date { get; set; } = DateTime.Now;
public DateTime DateCreate { get; set; } = DateTime.Now;
public string Status { get; set; } = string.Empty;
public int Id { get; set; }
public int ManagerId { get; set; }

View File

@ -6,8 +6,7 @@ namespace FurnitureContracts.BindingModels
{
public string Name { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public Dictionary<int, IOrdersModel> OrdersId { get; set; }
public int Id { get; set; }
public int ManagerId { get; set; }
}
public int Id { get; set; }
}
}

View File

@ -16,7 +16,7 @@ namespace FurnitureContracts.ViewModel
[DisplayName("Дата заказа")]
public DateTime Date { get; set; }
public DateTime DateCreate { get; set; }
[DisplayName("Статус")]
public string Status { get; set; } = string.Empty;

View File

@ -150,7 +150,7 @@ namespace FurnitureFactoryBusinessLogic.BusinessLogic
{
SalesSalonTitle = salessalons.FirstOrDefault(x => x.Id == salessalonOrder).ToString(),
OrderTitle = order.Title,
DateCreateOrder = order.Date,
DateCreateOrder = order.DateCreate,
HeadsetTitle = headset.Title,
});
}
@ -196,7 +196,7 @@ namespace FurnitureFactoryBusinessLogic.BusinessLogic
{
SalesSalonTitle = interests.FirstOrDefault(x => x.Id == interestOrder).ToString(),
OrderTitle = order.Title,
DateCreateOrder = order.Date,
DateCreateOrder = order.DateCreate,
HeadsetTitle = headset.Title,
DateCreateHeadset = headset.DateCreate
});

View File

@ -18,16 +18,16 @@ namespace FurnitureFactoryDataBaseImplement
{
public class FurnitureDataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=FurnitureFactory;Username=postgres;Password=Jus999666Y");
}
base.OnConfiguring(optionsBuilder);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=FurnitureFactory;Username=postgres;Password=Jus999666Y");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Manager> Managers { set; get; }
public virtual DbSet<Manager> Managers { set; get; }
public virtual DbSet<SalesSalons> SalesSalons { set; get; }
public virtual DbSet<Headset> Headsets { set; get; }
public virtual DbSet<HeadsetSalesSalons> HeadsetSalesSalons { set; get; }

View File

@ -39,7 +39,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
return context.Orders
.Include(x => x.SalesSalons)
.ThenInclude(x => x.SalesSalons)
.Where(x => x.Date >= model.DateFrom && x.Date <= model.DateTo && x.ManagerId == model.ManagerId)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.ManagerId == model.ManagerId)
.ToList()
.Select(x => x.GetViewModel)
.ToList();

View File

@ -18,7 +18,7 @@ namespace FurnitureFactoryDataBaseImplement.Models
[Required]
public string Status { get; set; } = string.Empty;
[Required]
public DateTime Date { get; set; }
public DateTime DateCreate { get; set; }
[Required]
public int ManagerId { get; set; }
public virtual Manager Manager { get; set; }
@ -50,7 +50,7 @@ namespace FurnitureFactoryDataBaseImplement.Models
Id = model.Id,
Title = model.Title,
Status = model.Status,
Date = model.Date,
DateCreate = model.DateCreate,
ManagerId = model.ManagerId,
SalesSalons = model.OrdersSalesSalons.Select(x => new OrdersSalesSalons
{
@ -62,7 +62,7 @@ namespace FurnitureFactoryDataBaseImplement.Models
public void Update(OrdersBindingModel model)
{
Status = model.Status;
Date = model.Date;
DateCreate = model.DateCreate;
}
public OrdersViewModel GetViewModel => new()
@ -70,7 +70,7 @@ namespace FurnitureFactoryDataBaseImplement.Models
Id = Id,
Title = Title,
Status = Status,
Date = Date,
DateCreate = DateCreate,
ManagerId = ManagerId,
OrdersSalesSalons = OrdersSalesSalons
};

View File

@ -9,7 +9,7 @@ namespace FurnitureFactoryDataModels.Models
public interface IOrdersModel : IId
{
string Title { get; }
DateTime Date { get; }
DateTime DateCreate { get; }
string Status { get; }
public Dictionary<int, ISalesSalonsModel> OrdersSalesSalons { get; }
int ManagerId { get; }

View File

@ -338,7 +338,7 @@ namespace ManagerWebClient.Controllers
ManagerId = APIClient.Manager.Id,
Title = title,
Status = status,
Date = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc),
DateCreate = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc),
OrdersSalesSalons = orderSalesSalons
});
@ -386,7 +386,7 @@ namespace ManagerWebClient.Controllers
ManagerId = APIClient.Manager.Id,
Title = title,
Status = status,
Date = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc),
DateCreate = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc),
OrdersSalesSalons = orderSalesSalons
});