public CustomerDTO GetCustomerById(int id) { var customer = _dataBase.Customers.Get(id); if (customer is null) { throw new ValidationException("Failed to get customer", "null error"); } var customerDto = MappingDTO.MapCustomerDTO(customer); return(customerDto); }
public CustomerDTO GetCustomerByIdentityUserId(string userId) { var customerId = _dataBase.Customers.GetCustomerIdByIdentityUserId(userId); if (customerId == -1) { return(null); } var customer = _dataBase.Customers.Get(customerId); var customerDto = MappingDTO.MapCustomerDTO(customer); return(customerDto); }