public async Task <Payout> GetById(int payoutId) { using (var context = new MineContext()) { return(await context.Wyplaty.AsNoTracking().SingleAsync(x => x.PayoutId == payoutId)); } }
public async Task <List <Payout> > GetWithFilter(Expression <Func <Payout, bool> > filter) { using (var context = new MineContext()) { return(await context.Wyplaty.AsNoTracking().AsQueryable().Where(filter).ToListAsync()); } }
public async Task <bool> Exists(string firstName, string LastName, DateTime birth) { using (var context = new MineContext()) { return(await context.Persons.AnyAsync(x => x.FirstName == firstName && x.LastName == LastName && x.BirthDate == birth.Date)); } }
public async Task <Person> GetById(int personId) { using (var context = new MineContext()) { return(await context.Persons.AsNoTracking().SingleAsync(x => x.PersonId == personId)); } }
public async Task <List <Person> > GetAll() { using (var context = new MineContext()) { return(await context.Persons.AsNoTracking().ToListAsync()); } }
public async Task <Payout> Create(Payout payout) { using (var context = new MineContext()) { context.Wyplaty.Add(payout); await context.SaveChangesAsync(); } return(payout); }
public async Task <Person> Create(Person person) { using (var context = new MineContext()) { context.Persons.Add(person); await context.SaveChangesAsync(); } return(person); }
public async Task <MoneyCount> Create(MoneyCount kasa) { using (var context = new MineContext()) { context.Kasa.Add(kasa); await context.SaveChangesAsync(); } return(kasa); }
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 <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 <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); }