public async Task DeleteProduct(long id) { var product = GetProduct(id); if (product != null) { _dbContext.Remove <Product>(product); await _dbContext.SaveChangesAsync(); } }
public async Task AddUser(User newUser) { var user = GetUser(newUser.Login, newUser.Password); if (user == null) { await _dbContext.Users.AddAsync(newUser); await _dbContext.SaveChangesAsync(); } }
public async Task AddColumn(Column column, long userId, long?productId) { column.ProductId = productId; column.UserId = userId; await _dbContext.AddAsync(column); await _dbContext.SaveChangesAsync(); }
public async Task DeleteAdvertisement(long id) { var advertisement = GetAdvertisement(id); if (advertisement != null) { _dbContext.Remove <Advertisement>(advertisement); } await _dbContext.SaveChangesAsync(); }
public async Task AddManufacturer(Manufacturer manufacturer) { await _dbContext.AddAsync(manufacturer); await _dbContext.SaveChangesAsync(); }