public async Task <StoreViynl> Create(StoreViynl entity) { if (entity == null) { throw new Exception("Entity cannot be null"); } var result = await _dbContext .StoreTracks.AddAsync(entity); await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <StoreViynl> Update(StoreViynl entity) { if (entity == null) { throw new Exception("Entity cannot be null"); } _dbContext.StoreTracks.Attach(entity); var entry = _dbContext.Entry(entity); entry.State = EntityState.Modified; await _dbContext.SaveChangesAsync(); return(entry.Entity); }