PIbd-22 Isaeva A.I. Lab work 3 Base #4

Closed
dex_moth wants to merge 5 commits from lab3 into lab2
6 changed files with 6 additions and 13 deletions
Showing only changes of commit a003aff777 - Show all commits

View File

@ -1,14 +1,5 @@
using FishFactoryDataModel.Models;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FishFactoryContracts.BusinessLogicsContracts;
using FishFactoryContracts.SearchModels;
using FishFactoryContracts.BindingModels;

View File

@ -9,7 +9,7 @@ namespace FishFactoryDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory;Username=postgres;Password=postgres");
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory2;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FishFactoryDatabaseImplement.Migrations
{
[DbContext(typeof(FishFactoryDatabase))]
[Migration("20240319164852_InitialCreate")]
[Migration("20240320065127_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />

View File

@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace FishFactoryDatabaseImplement.Models
{
public class Canned
public class Canned : ICannedModel
{
public int Id { get; set; }
[Required]

View File

@ -3,10 +3,11 @@ using System.ComponentModel.DataAnnotations;
using FishFactoryDataModel.Enums;
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.ViewModels;
using FishFactoryDataModel.Models;
namespace FishFactoryDatabaseImplement.Models
{
public class Order
public class Order : IOrderModel
{
public int Id { get; private set; }
[Required]
@ -27,6 +28,7 @@ namespace FishFactoryDatabaseImplement.Models
{
Id = model.Id,
CannedId = model.CannedId,
Canned = context.Canneds.First(x => x.Id == model.CannedId),
Count = model.Count,
Sum = model.Sum,
Status = model.Status,