| | | 1 | | using Microsoft.EntityFrameworkCore; |
| | | 2 | | using OzonDomains.Models; |
| | | 3 | | using OzonRepositories.Context; |
| | | 4 | | using OzonRepositories.Data; |
| | | 5 | | |
| | | 6 | | namespace Services.DataServices.ExcelMapping; |
| | | 7 | | |
| | | 8 | | public class ExcludedBitrixWarehouseRepository : MainRepository, IRepository<ExcludedBitrixWarehouse> |
| | | 9 | | { |
| | 0 | 10 | | public ExcludedBitrixWarehouseRepository(ApplicationDbContext orderContext) : base(orderContext) |
| | | 11 | | { |
| | 0 | 12 | | } |
| | | 13 | | |
| | | 14 | | public async Task<int> Add(ExcludedBitrixWarehouse value) |
| | | 15 | | { |
| | 0 | 16 | | await _context.ExcludedBitrixWarehouses.AddAsync(value); |
| | 0 | 17 | | return await _context.SaveChangesAsync(); |
| | 0 | 18 | | } |
| | | 19 | | |
| | | 20 | | public async Task<int> Delete(ExcludedBitrixWarehouse value) |
| | | 21 | | { |
| | 0 | 22 | | _context.ExcludedBitrixWarehouses.Remove(value); |
| | 0 | 23 | | return await _context.SaveChangesAsync(); |
| | 0 | 24 | | } |
| | | 25 | | |
| | | 26 | | public async Task<List<ExcludedBitrixWarehouse>> Get() |
| | | 27 | | { |
| | 0 | 28 | | return await _context.ExcludedBitrixWarehouses.ToListAsync(); |
| | 0 | 29 | | } |
| | | 30 | | |
| | | 31 | | public async Task<ExcludedBitrixWarehouse?> GetAsync(int id) |
| | | 32 | | { |
| | 0 | 33 | | return await _context.ExcludedBitrixWarehouses.FirstOrDefaultAsync(x => x.Id == id); |
| | 0 | 34 | | } |
| | | 35 | | |
| | | 36 | | public async Task<ExcludedBitrixWarehouse?> GetAsync(ExcludedBitrixWarehouse value) |
| | | 37 | | { |
| | 0 | 38 | | return await _context.ExcludedBitrixWarehouses.FirstOrDefaultAsync(x => x.Name == value.Name); |
| | 0 | 39 | | } |
| | | 40 | | |
| | | 41 | | public async Task<bool> ExistsByNameAsync(string name) |
| | | 42 | | { |
| | 0 | 43 | | return await _context.ExcludedBitrixWarehouses.AnyAsync(x => x.Name == name); |
| | 0 | 44 | | } |
| | | 45 | | |
| | | 46 | | public async Task<int> Update(ExcludedBitrixWarehouse value) |
| | | 47 | | { |
| | 0 | 48 | | _context.ExcludedBitrixWarehouses.Update(value); |
| | 0 | 49 | | return await _context.SaveChangesAsync(); |
| | 0 | 50 | | } |
| | | 51 | | } |