public async Task <Doplata> Create(Doplata doplata)
        {
            using (var context = new MineContext())
            {
                context.Doplaty.Add(doplata);
                await context.SaveChangesAsync();
            }

            return(doplata);
        }
        public async Task <Binocle> Create(Binocle binocle)
        {
            using (var context = new MineContext())
            {
                context.Binocles.Add(binocle);
                await context.SaveChangesAsync();
            }

            return(binocle);
        }
        public async Task <Element> Create(Element element)
        {
            using (var context = new MineContext())
            {
                context.Elements.Add(element);
                await context.SaveChangesAsync();
            }

            return(element);
        }
        public async Task <Payout> Create(Payout payout)
        {
            using (var context = new MineContext())
            {
                context.Wyplaty.Add(payout);
                await context.SaveChangesAsync();
            }

            return(payout);
        }
Exemple #5
0
        public async Task <Person> Create(Person person)
        {
            using (var context = new MineContext())
            {
                context.Persons.Add(person);
                await context.SaveChangesAsync();
            }

            return(person);
        }
Exemple #6
0
        public async Task <MoneyCount> Create(MoneyCount kasa)
        {
            using (var context = new MineContext())
            {
                context.Kasa.Add(kasa);
                await context.SaveChangesAsync();
            }

            return(kasa);
        }
        //TODO: uzupełnić o propercje
        //public async Task<Binocle> Update(Binocle binocle)
        //{
        //    using (var context = new MineContext())
        //    {
        //        context.Binocles.Attach(binocle);
        //        context.Entry(binocle).State = EntityState.Unchanged;

        //        context.Entry(binocle).Property(a => a.BlizOL).IsModified = true;
        //        context.Entry(binocle).Property(a => a.BlizOP).IsModified = true;
        //        context.Entry(binocle).Property(a => a.BuyDate).IsModified = true;
        //        context.Entry(binocle).Property(a => a.CenaOprawekBliz).IsModified = true;
        //        context.Entry(binocle).Property(a => a.CenaOprawekDal).IsModified = true;
        //        context.Entry(binocle).Property(a => a.DalOL).IsModified = true;
        //        context.Entry(binocle).Property(a => a.DalOP).IsModified = true;
        //        context.Entry(binocle).Property(a => a.DataOdbioru).IsModified = true;
        //        context.Entry(binocle).Property(a => a.Description).IsModified = true;
        //        context.Entry(binocle).Property(a => a.FormaPlatnosci).IsModified = true;
        //        context.Entry(binocle).Property(a => a.NumerZlecenia).IsModified = true;
        //        context.Entry(binocle).Property(a => a.IsDataOdbioru).IsModified = true;
        //        context.Entry(binocle).Property(a => a.BlizOL).IsModified = true;
        //        //TODO: Uzupełnić pozostałe, jeśli będzie potrzeba
        //        //context.Entry(binocle).Property(a => a.BlizOP).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.BuyDate).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.CenaOprawekBliz).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.CenaOprawekDal).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.DalOL).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.DalOP).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.DataOdbioru).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.Description).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.FormaPlatnosci).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.NumerZlecenia).IsModified = true;
        //        //context.Entry(binocle).Property(a => a.IsDataOdbioru).IsModified = true;

        //        await context.SaveChangesAsync();
        //    }

        //    return binocle;
        //}

        public async Task Delete(int binocleId)
        {
            using (var context = new MineContext())
            {
                var binocle = await context.Binocles.SingleAsync(x => x.BinocleId == binocleId);

                context.Entry(binocle).State = EntityState.Deleted;

                await context.SaveChangesAsync();
            }
        }
        public async Task Delete(int elementId)
        {
            using (var context = new MineContext())
            {
                var element = await context.Elements.SingleAsync(x => x.ElementId == elementId);

                context.Entry(element).State = EntityState.Deleted;

                await context.SaveChangesAsync();
            }
        }
        public async Task Delete(int doplataId)
        {
            using (var context = new MineContext())
            {
                var doplata = await context.Doplaty.SingleAsync(x => x.DoplataId == doplataId);

                context.Entry(doplata).State = EntityState.Deleted;

                await context.SaveChangesAsync();
            }
        }
        public async Task Delete(int payoutId)
        {
            using (var context = new MineContext())
            {
                var payout = await context.Wyplaty.SingleAsync(x => x.PayoutId == payoutId);

                context.Entry(payout).State = EntityState.Deleted;

                await context.SaveChangesAsync();
            }
        }
Exemple #11
0
        public async Task Delete(int personId)
        {
            using (var context = new MineContext())
            {
                var person = await context.Persons.SingleAsync(x => x.PersonId == personId);

                context.Entry(person).State = EntityState.Deleted;

                await context.SaveChangesAsync();
            }
        }
        public async Task <Doplata> Update(Doplata doplata)
        {
            using (var context = new MineContext())
            {
                context.Doplaty.Attach(doplata);
                context.Entry(doplata).State = EntityState.Unchanged;

                context.Entry(doplata).Property(a => a.DataDoplaty).IsModified    = true;
                context.Entry(doplata).Property(a => a.Kwota).IsModified          = true;
                context.Entry(doplata).Property(a => a.FormaPlatnosci).IsModified = true;

                await context.SaveChangesAsync();
            }

            return(doplata);
        }
        public async Task <Payout> Update(Payout payout)
        {
            using (var context = new MineContext())
            {
                context.Wyplaty.Attach(payout);
                context.Entry(payout).State = EntityState.Unchanged;

                context.Entry(payout).Property(a => a.Amount).IsModified      = true;
                context.Entry(payout).Property(a => a.Description).IsModified = true;
                context.Entry(payout).Property(a => a.CreatedOn).IsModified   = true;
                context.Entry(payout).Property(a => a.Lokalizacja).IsModified = true;

                await context.SaveChangesAsync();
            }

            return(payout);
        }
        public async Task <Element> Update(Element element)
        {
            using (var context = new MineContext())
            {
                context.Elements.Attach(element);
                context.Entry(element).State = EntityState.Unchanged;

                context.Entry(element).Property(a => a.Nazwa).IsModified          = true;
                context.Entry(element).Property(a => a.DataSprzedazy).IsModified  = true;
                context.Entry(element).Property(a => a.FormaPlatnosci).IsModified = true;
                context.Entry(element).Property(a => a.Ilosc).IsModified          = true;
                context.Entry(element).Property(a => a.Cena).IsModified           = true;

                await context.SaveChangesAsync();
            }

            return(element);
        }
Exemple #15
0
        public async Task <Person> Update(Person person)
        {
            using (var context = new MineContext())
            {
                context.Persons.Attach(person);
                context.Entry(person).State = EntityState.Unchanged;

                context.Entry(person).Property(a => a.Address).IsModified     = true;
                context.Entry(person).Property(a => a.FirstName).IsModified   = true;
                context.Entry(person).Property(a => a.LastName).IsModified    = true;
                context.Entry(person).Property(a => a.BirthDate).IsModified   = true;
                context.Entry(person).Property(a => a.Lokalizacja).IsModified = true;

                await context.SaveChangesAsync();
            }

            return(person);
        }