Интерфейсы моделей, Binding модели, начало реализации

This commit is contained in:
the 2024-06-17 14:04:22 +04:00
parent 7511370fa3
commit 34fd2b04c4
13 changed files with 139 additions and 9 deletions

View File

@ -1,4 +1,5 @@
using System; using DataModels.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -6,10 +7,11 @@ using System.Threading.Tasks;
namespace Contracts.BindingModels namespace Contracts.BindingModels
{ {
public class MediaFileBindingModel public class MediaFileBindingModel : IMediaFile
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid ProductId { get; set; } public Guid ProductId { get; set; }
public string Name { get; set; } = string.Empty;
public string Location { get; set; } = string.Empty; public string Location { get; set; } = string.Empty;
} }
} }

View File

@ -1,4 +1,5 @@
using System; using DataModels.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -6,11 +7,13 @@ using System.Threading.Tasks;
namespace Contracts.BindingModels namespace Contracts.BindingModels
{ {
public class ProductBindingModel public class ProductBindingModel : IProduct
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public double Price { get; set; } public double Price { get; set; }
public int Amount { get; set; } public int Amount { get; set; }
public bool IsBeingSold { get; set; }
public double Rate { get; set; }
} }
} }

View 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;
}
}

View 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();
}
}

View 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; }
}
}

View 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
}
}

View File

@ -6,9 +6,10 @@ using System.Threading.Tasks;
namespace DataModels.Models namespace DataModels.Models
{ {
public interface IMediaFile public interface IMediaFile : IId
{ {
string Name { get; } string Name { get; }
string Location { get; } string Location { get; }
Guid ProductId { get; }
} }
} }

View File

@ -10,8 +10,10 @@ namespace DataModels.Models
{ {
string Name { get; } string Name { get; }
double Price { get; } double Price { get; }
bool IBeingSold { get; } bool IsBeingSold { get; }
public double Rate { get; } public double Rate { get; }
int Amount { get; } int Amount { get; }
// будут браться через mediafilestorage так что скорее всего это тут не надо
// List<IMediaFile> MediaFiles { get; }
} }
} }

View 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; }
}
}

View 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; }
}
}

View File

@ -9,5 +9,7 @@ namespace DataModels.Models
public interface ISupplyDoc : IId public interface ISupplyDoc : IId
{ {
string Name { get; } string Name { get; }
}
Guid SupplyId { get; }
}
} }

View File

@ -10,9 +10,13 @@ namespace DatabaseImplement.Models
{ {
public class MediaFile : IMediaFile public class MediaFile : IMediaFile
{ {
[Required]
public Guid Id { get; set; }
[Required] [Required]
public string Name { get; set; } public string Name { get; set; }
[Required] [Required]
public string Location { get; set; } public string Location { get; set; }
[Required]
public Guid ProductId { get; set; }
} }
} }

View File

@ -1,12 +1,26 @@
using System; using DataModels.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DatabaseImplement.Models 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; }
} }
} }