public Detail[] GetAllByIds(IEnumerable <int> detailIds) { var dbContext = dbContextFactory.Create(typeof(DetailRepository)); return(dbContext.Details .Where(detail => detailIds.Contains(detail.Id)) .AsEnumerable() .Select(Detail.Mapper.Map) .ToArray()); }
public Book[] GetAllByIds(IEnumerable <int> bookIds) { var dbContex = dbContextFactory.Create(typeof(BookRepository)); return(dbContex.Books .Where(book => bookIds.Contains(book.Id)) .AsEnumerable() .Select(Book.Mapper.Map) .ToArray()); }
public async Task <Order> CreateAsync() { var dbContext = dbContextFactory.Create(typeof(OrderRepository)); var dto = Order.DtoFactory.Create(); dbContext.Orders.Add(dto); await dbContext.SaveChangesAsync(); return(Order.Mapper.Map(dto)); }
public async Task <Book[]> GetAllByIdsAsync(IEnumerable <int> bookIds) { var dbContext = dbContextFactory.Create(typeof(BookRepository)); var dtos = await dbContext.Books .Where(book => bookIds.Contains(book.Id)) .ToArrayAsync(); return(dtos.Select(Book.Mapper.Map) .ToArray()); }
public Order Create() { var dbContex = dbContextFactory.Create(typeof(OrderRepository)); var dto = Order.DtoFactory.Create(); dbContex.Orders.Add(dto); dbContex.SaveChanges(); return(Order.Mapper.Map(dto)); }