Интерфейсы моделей, Binding модели, начало реализации
This commit is contained in:
parent
7511370fa3
commit
34fd2b04c4
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,10 +7,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
public class MediaFileBindingModel
|
||||
public class MediaFileBindingModel : IMediaFile
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ProductId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Location { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,11 +7,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
public class ProductBindingModel
|
||||
public class ProductBindingModel : IProduct
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
public int Amount { get; set; }
|
||||
public bool IsBeingSold { get; set; }
|
||||
public double Rate { get; set; }
|
||||
}
|
||||
}
|
||||
|
17
Contracts/BindingModels/SupplierBindingModel.cs
Normal file
17
Contracts/BindingModels/SupplierBindingModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
public class SupplierBindingModel : ISupplier
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public Dictionary<int, (IProduct, int)> AvailibleProducts { get; set; } = new();
|
||||
public int Deals { get; set; } = 0;
|
||||
}
|
||||
}
|
20
Contracts/BindingModels/SupplyBindingModel.cs
Normal file
20
Contracts/BindingModels/SupplyBindingModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using DataModels.Enums;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
internal class SupplyBindingModel : ISupply
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; }
|
||||
public double Price { get; set; }
|
||||
public SupplyStatus Status { get; set; }
|
||||
public Dictionary<int, (IProduct, int)> SupplyProducts { get; set; } = new();
|
||||
}
|
||||
}
|
17
Contracts/BindingModels/SupplyDocBindingModel.cs
Normal file
17
Contracts/BindingModels/SupplyDocBindingModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Contracts.BindingModels
|
||||
{
|
||||
public class SupplyDocBindingModel : ISupplyDoc
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public Guid SupplyId { get; set; }
|
||||
|
||||
}
|
||||
}
|
15
DataModels/Enums/SupplyStatus.cs
Normal file
15
DataModels/Enums/SupplyStatus.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataModels.Enums
|
||||
{
|
||||
public enum SupplyStatus
|
||||
{
|
||||
Pending = -1,
|
||||
Arriving = 0,
|
||||
Completed = 1
|
||||
}
|
||||
}
|
@ -6,9 +6,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DataModels.Models
|
||||
{
|
||||
public interface IMediaFile
|
||||
public interface IMediaFile : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Location { get; }
|
||||
Guid ProductId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ namespace DataModels.Models
|
||||
{
|
||||
string Name { get; }
|
||||
double Price { get; }
|
||||
bool IBeingSold { get; }
|
||||
bool IsBeingSold { get; }
|
||||
public double Rate { get; }
|
||||
int Amount { get; }
|
||||
// будут браться через mediafilestorage так что скорее всего это тут не надо
|
||||
// List<IMediaFile> MediaFiles { get; }
|
||||
}
|
||||
}
|
||||
|
15
DataModels/Models/ISupplier.cs
Normal file
15
DataModels/Models/ISupplier.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataModels.Models
|
||||
{
|
||||
public interface ISupplier : IId
|
||||
{
|
||||
string Name { get; }
|
||||
Dictionary<int, (IProduct, int)> AvailibleProducts { get; }
|
||||
int Deals { get; }
|
||||
}
|
||||
}
|
18
DataModels/Models/ISupply.cs
Normal file
18
DataModels/Models/ISupply.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using DataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataModels.Models
|
||||
{
|
||||
public interface ISupply: IId
|
||||
{
|
||||
string Name { get; }
|
||||
double Price { get; }
|
||||
DateTime Date { get; }
|
||||
SupplyStatus Status { get; }
|
||||
Dictionary<int, (IProduct, int)> SupplyProducts { get; }
|
||||
}
|
||||
}
|
@ -9,5 +9,7 @@ namespace DataModels.Models
|
||||
public interface ISupplyDoc : IId
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
Guid SupplyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,13 @@ namespace DatabaseImplement.Models
|
||||
{
|
||||
public class MediaFile : IMediaFile
|
||||
{
|
||||
[Required]
|
||||
public Guid Id { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public string Location { get; set; }
|
||||
[Required]
|
||||
public Guid ProductId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,26 @@
|
||||
using System;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DatabaseImplement.Models
|
||||
{
|
||||
public class Product
|
||||
public class Product : IProduct
|
||||
{
|
||||
[Required]
|
||||
public Guid Id { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public double Price { get; set; }
|
||||
[Required]
|
||||
public double Rate { get; set; }
|
||||
[Required]
|
||||
public bool IsBeingSold { get; set; }
|
||||
[Required]
|
||||
public int Amount { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user