private void UpdateCustomerHistory(int idCustomer) { var searchCustomerHistory = _customerRepository.GetCustomerHistory(idCustomer); if (searchCustomerHistory != null) { searchCustomerHistory.AmountOfSearch++; _customerRepository.UpdateSearchCustomerHistory(searchCustomerHistory); } else { var newHistory = new SearchCustomerHistory { AmountOfSearch = 1, IdCustomer = idCustomer }; _customerRepository.CreateSearchCustomerHistory(newHistory); } }
public bool CreateSearchCustomerHistory(SearchCustomerHistory newHistory) { _context.SearchCustomerHistories.Add(newHistory); return(_context.SaveChanges() > 0); }
public bool UpdateSearchCustomerHistory(SearchCustomerHistory searchCustomerHistory) { _context.SearchCustomerHistories.Update(searchCustomerHistory); return(_context.SaveChanges() > 0); }