Exemplo n.º 1
0
        public void AddOrUpdateManager(Managers manager)
        {
            using (var context = new PrimeDatingContext())
            {
                context.Managers.AddOrUpdate(manager);

                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public void AddOrUpdateGirl(Girls girl)
        {
            using (var context = new PrimeDatingContext())
            {
                context.Girls.AddOrUpdate(girl);

                context.SaveChanges();
            }
        }
        public void AddOrUpdateOrders(List <Orders> orders)
        {
            using (var context = new PrimeDatingContext())
            {
                foreach (var order in orders)
                {
                    context.Orders.AddOrUpdate(order);
                }

                context.SaveChanges();
            }
        }
        public void AddOrUpdateGifts(List <Gifts> gifts)
        {
            using (var context = new PrimeDatingContext())
            {
                foreach (var gift in gifts)
                {
                    context.Gifts.AddOrUpdate(gift);
                }

                context.SaveChanges();
            }
        }
Exemplo n.º 5
0
        public void AddOrUpdateMen(List <Men> men)
        {
            using (var context = new PrimeDatingContext())
            {
                foreach (var man in men)
                {
                    context.Men.AddOrUpdate(man);
                }

                context.SaveChanges();
            }
        }
        public void AddOrUpdatePayments(List <Payments> payments)
        {
            using (var context = new PrimeDatingContext())
            {
                foreach (var payment in payments)
                {
                    if (!context.Payments.Any(t =>
                                              t.AdminAreaId == payment.AdminAreaId && t.Date == payment.Date && t.GirlId == payment.GirlId &&
                                              t.ManagerId == payment.ManagerId && t.PaymentTypeId == payment.PaymentTypeId))
                    {
                        context.Payments.Add(payment);
                    }
                }

                context.SaveChanges();
            }
        }
        public AdminArea CreateAdminArea(string adminAreaName)
        {
            using (var context = new PrimeDatingContext())
            {
                context.AdminAreases.AddOrUpdate(new AdminAreas {
                    Name = adminAreaName
                });

                context.SaveChanges();

                return(context.AdminAreases.Where(t => t.Name == adminAreaName)
                       .Select(t => new AdminArea {
                    Id = t.Id, AdminAreaName = t.Name
                })
                       .FirstOrDefault());
            }
        }
Exemplo n.º 8
0
        public void AddOrUpdatePassportScans(int girlId, List <string> passportScans)
        {
            using (var context = new PrimeDatingContext())
            {
                var result = context.GirlsPassportScans
                             .Where(t => t.GirlId == girlId).ToList();

                foreach (var passportScan in passportScans.Where(t => !result.Exists(c => c.Url == t)))
                {
                    context.GirlsPassportScans.AddOrUpdate(new GirlsPassportScans
                    {
                        GirlId = girlId,
                        Url    = passportScan
                    });
                }

                context.SaveChanges();
            }
        }
Exemplo n.º 9
0
        public void AddOrUpdateImages(int girlId, List <string> images)
        {
            using (var context = new PrimeDatingContext())
            {
                var result = context.GirlsImages
                             .Where(t => t.GirlId == girlId).ToList();

                foreach (var image in images.Where(t => !result.Exists(c => c.Url == t)))
                {
                    context.GirlsImages.AddOrUpdate(new GirlsImages
                    {
                        GirlId = girlId,
                        Url    = image
                    });
                }

                context.SaveChanges();
            }
        }
Exemplo n.º 10
0
        public void AddOrUpdateManagersGirlsReference(List <ManagersGirls> managersGirlsReference)
        {
            using (var context = new PrimeDatingContext())
            {
                foreach (var managerGirlReference in managersGirlsReference)
                {
                    var reference =
                        context.ManagersGirls.Find(managerGirlReference.GirlId, managerGirlReference.ManagerId);

                    if (reference == null)
                    {
                        context.ManagersGirls.Add(new ManagersGirls
                        {
                            Creation  = DateTime.Now,
                            GirlId    = managerGirlReference.GirlId,
                            ManagerId = managerGirlReference.ManagerId
                        });
                    }
                }

                context.SaveChanges();
            }
        }