< Summary

Information
Class: OzonRepositories.Data.BitrixStockSavedFilterRepository
Assembly: OzonRepositories
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonRepositories/Data/BitrixStockSavedFilterRepository.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 55
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
Add()100%210%
Delete()100%210%
Get()100%210%
GetAsync()100%210%
GetAsync()100%210%
Update()100%210%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonRepositories/Data/BitrixStockSavedFilterRepository.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2using OzonDomains.Models;
 3using OzonRepositories.Context;
 4
 5namespace OzonRepositories.Data
 6{
 7    public class BitrixStockSavedFilterRepository : MainRepository, IRepository<BitrixStockSavedFilter>
 8    {
 09        public BitrixStockSavedFilterRepository(ApplicationDbContext orderContext) : base(orderContext)
 10        {
 011        }
 12
 13        public async Task<int> Add(BitrixStockSavedFilter value)
 14        {
 015            value.CreatedAt = DateTime.UtcNow;
 016            await _context.BitrixStockSavedFilters.AddAsync(value);
 017            return await _context.SaveChangesAsync();
 018        }
 19
 20        public async Task<int> Delete(BitrixStockSavedFilter value)
 21        {
 022            _context.BitrixStockSavedFilters.Remove(value);
 023            return await _context.SaveChangesAsync();
 024        }
 25
 26        public async Task<List<BitrixStockSavedFilter>> Get()
 27        {
 028            return await _context.BitrixStockSavedFilters
 029                .OrderByDescending(f => f.CreatedAt)
 030                .ToListAsync();
 031        }
 32
 33        public async Task<BitrixStockSavedFilter?> GetAsync(int id)
 34        {
 035            return await _context.BitrixStockSavedFilters.FindAsync(id);
 036        }
 37
 38        public async Task<BitrixStockSavedFilter?> GetAsync(BitrixStockSavedFilter value)
 39        {
 040            return await _context.BitrixStockSavedFilters
 041                .FirstOrDefaultAsync(f => f.Name == value.Name);
 042        }
 43
 44        public async Task<int> Update(BitrixStockSavedFilter value)
 45        {
 046            value.UpdatedAt = DateTime.UtcNow;
 047            _context.BitrixStockSavedFilters.Update(value);
 048            return await _context.SaveChangesAsync();
 049        }
 50    }
 51}
 52
 53
 54
 55