Add search models

This commit is contained in:
ShabOl 2024-05-15 21:37:18 +04:00
parent c11d13384a
commit c81946029d
11 changed files with 118 additions and 6 deletions

View File

@ -0,0 +1,15 @@
namespace SushiBarContracts.BindingModels
{
public class ChequeBindingModel
{
public List<ChequeItemBindingModel> ChequeItems { get; set; } = new();
public int? CustomerId { get; set; }
public DateTime OrderDate { get; set; }
public double TotalSum { get; set; }
public int? PromotionId { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace SushiBarContracts.BindingModels
{
public class ChequeItemBindingModel
{
public int DishId { get; set; }
public int CookId { get; set; }
public int Count { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SushiBarContracts.BindingModels
{
public class CookBindingModel
{
public string Fio { get; set; } = string.Empty;
public DateTime EmploymentDate { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SushiBarContracts.BindingModels
{
public class CustomerBindingModel
{
public string Fio { get; set; } = string.Empty;
public DateTime? BirthdayDate { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace SushiBarContracts.BindingModels
{
public class DishBindingModel
{
public string DishName { get; set; } = string.Empty;
public string Category { get; set;} = string.Empty;
public List<DishIngredientBindingModel> Ingredients { get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
namespace SushiBarContracts.BindingModels
{
public class DishIngredientBindingModel
{
public int IngredientId { get; set; }
public int Count { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace SushiBarContracts.BindingModels
{
public class IngredientBindingModel
{
public string IngredientName { get; set; } = string.Empty;
public string Unit { get; set; } = string.Empty;
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace SushiBarContracts.BindingModels
{
public class PromotionBindingModel
{
public string PromotionName { get; set; } = string.Empty;
public float Discount { get; set; }
public double TriggeringSum { get; set; }
}
}

View File

@ -6,8 +6,4 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Folder Include="BindingModels\" />
</ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations; using SushiBarContracts.BindingModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Linq;
namespace SushiBarDatabaseImplement.Models namespace SushiBarDatabaseImplement.Models
{ {
@ -19,5 +21,31 @@ namespace SushiBarDatabaseImplement.Models
[ForeignKey("IngredientId")] [ForeignKey("IngredientId")]
public virtual List<DishIngredient> DishIngredients { get; set; } = new(); public virtual List<DishIngredient> DishIngredients { get; set; } = new();
public static Ingredient? Create(IngredientBindingModel Model)
{
return new Ingredient()
{
IngredientName = Model.IngredientName,
name = model.name,
facultyid = model.facultyid,
};
}
public void Update(CourseBindingModel model)
{
if (model == null)
{
return;
}
name = model.name;
facultyid = model.facultyid;
}
public CourseViewModel ViewModel => new()
{
course_id = course_id,
name = name,
facultyid = facultyid,
FacultyName = Faculty.name,
};
} }
} }

View File

@ -6,7 +6,9 @@ namespace SushiBarDatabaseImplement.Storages
{ {
public List<IngredientViewModel> GetFullList() public List<IngredientViewModel> GetFullList()
{ {
return new List<IngredientViewModel>(); using var Context = new SushiBarDatabase();
return
} }
} }
} }