Пример #1
0
        public FakeRepository()
        {
            // Инициализация клиентов
            #region
            c1 = new Client_InfraModel
            {
                Id                  = 1,
                ClientTitle         = "Иванов Иван Иванович",
                ClientMarkJuridical = false,
                ClientPhone         = "+375-44-458-77-33",
                ClientEMail         = "12google@com",
                ClientTaxpayNum     = "MP1234145"
            };
            DB_Clients.Add(c1);
            c2 = new Client_InfraModel
            {
                Id                  = 2,
                ClientTitle         = "Модная Галактика",
                ClientMarkJuridical = true,
                ClientPhone         = "+375-33-345-99-36",
                ClientEMail         = "*****@*****.**",
                ClientTaxpayNum     = "127124783"
            };
            DB_Clients.Add(c2);
            #endregion

            // Инициализация р/с
            #region
            b1 = new Bill_InfraModel
            {
                Id                  = 1,
                BillBalance         = 120,
                BillNumber          = "12345611111112225841",
                Client_InfraModelId = 1
                                      //ClientOwnerOfBill = c1
            };
            DB_Bills.Add(b1);
            b2 = new Bill_InfraModel
            {
                Id                  = 2,
                BillBalance         = 158880,
                BillNumber          = "12345612345678921782",
                Client_InfraModelId = 2
                                      //ClientOwnerOfBill = c2
            };
            DB_Bills.Add(b2);
            b3 = new Bill_InfraModel
            {
                Id                  = 3,
                BillBalance         = 1100,
                BillNumber          = "12345125874563216783",
                Client_InfraModelId = 2
                                      //ClientOwnerOfBill = c2
            };
            DB_Bills.Add(b3);
            #endregion
        }
Пример #2
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            Client_InfraModel c1 = new Client_InfraModel
            {
                Id                  = 1,
                ClientTitle         = "Иванов Иван Иванович",
                ClientMarkJuridical = false,
                ClientPhone         = "+375-44-458-77-33",
                ClientEMail         = "12google@com",
                ClientTaxpayNum     = "MP1234145"
            };
            Client_InfraModel c2 = new Client_InfraModel
            {
                Id                  = 2,
                ClientTitle         = "Модная Галактика",
                ClientMarkJuridical = true,
                ClientPhone         = "+375-33-345-99-36",
                ClientEMail         = "*****@*****.**",
                ClientTaxpayNum     = "127124783"
            };

            Bill_InfraModel b1 = new Bill_InfraModel
            {
                Id                  = 1,
                BillBalance         = 120,
                BillNumber          = "12345611111112225841",
                Client_InfraModelId = 1,
                //ClientOwnerOfBill = c1
            };
            Bill_InfraModel b2 = new Bill_InfraModel
            {
                Id                  = 2,
                BillBalance         = 158880,
                BillNumber          = "12345612345678921782",
                Client_InfraModelId = 2,
                //ClientOwnerOfBill = c2
            };
            Bill_InfraModel b3 = new Bill_InfraModel
            {
                Id                  = 3,
                BillBalance         = 1100,
                BillNumber          = "12345125874563216783",
                Client_InfraModelId = 2,
                //ClientOwnerOfBill = c2
            };

            modelBuilder.Entity <Client_InfraModel>().HasData(c1, c2);
            modelBuilder.Entity <Bill_InfraModel>().HasData(b1, b2, b3);

            modelBuilder.ApplyConfiguration <Client_InfraModel>(new Client_Configuration());
            modelBuilder.ApplyConfiguration <Bill_InfraModel>(new Bill_Configuration());

            base.OnModelCreating(modelBuilder);
        }
        public void UpdateCl(Client_InfraModel inst)
        {
            //context.Entry(inst).State = EntityState.Modified;
            var tempInst = context.Clients.FirstOrDefault(_ => _.Id == inst.Id);

            tempInst.Id                  = inst.Id;
            tempInst.ClientEMail         = inst.ClientEMail;
            tempInst.ClientMarkJuridical = inst.ClientMarkJuridical;
            tempInst.ClientPhone         = inst.ClientPhone;
            tempInst.ClientTaxpayNum     = inst.ClientTaxpayNum;
            tempInst.ClientTitle         = inst.ClientTitle;
            context.SaveChanges();
        }
Пример #4
0
 public static Client_DomainModel ClientFromInfraToDomain(this Client_InfraModel @this)
 {
     if (@this != null)
     {
         return(new Client_DomainModel()
         {
             Id = @this.Id,
             ClientTitle = @this.ClientTitle,
             ClientMarkJuridical = @this.ClientMarkJuridical,
             ClientTaxpayNum = @this.ClientTaxpayNum,
             ClientPhone = @this.ClientPhone,
             ClientEMail = @this.ClientEMail
         });
     }
     else
     {
         return(null);
     }
 }
Пример #5
0
        public void UpdateCl(Client_InfraModel inst)
        {
            var temp = DB_Clients.FirstOrDefault(_ => _.Id == inst.Id);

            temp = inst;
        }
Пример #6
0
 public void CreateCl(Client_InfraModel inst)
 {
     DB_Clients.Add(inst);
 }
 public void CreateCl(Client_InfraModel inst)
 {
     context.Clients.Add(inst);
     context.SaveChanges();
 }