using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DiplomovaPrace.Model.Orders;
using Microsoft.EntityFrameworkCore;

namespace DiplomovaPrace.DataLayer.Repositories.Orders
{
	public partial class AddressDbRepository : IAddressRepository
	{
		public async Task<List<Address>> GetAddressesByUserIDAsync(int userID)
		{
			return await DataIncludingDeleted.Where(i => i.LoginAccountID == userID).ToListAsync().ConfigureAwait(false);
		}

		/// <summary>
		/// Gets all non deleted addresses of user by ID
		/// </summary>
		/// <param name="userID">User ID</param>
		/// <returns>Collection of user addresses</returns>
		public async Task<List<Address>> GetActiveAddressesByUserIDAsync(int userID)
		{
			return await Data.Where(i => i.LoginAccountID == userID).ToListAsync().ConfigureAwait(false);
		}
	}
}