You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Shared;
|
|
|
|
/// <summary>
|
|
/// Generic object interface containing CRUD methods
|
|
/// </summary>
|
|
/// <typeparam name="TObject"> Generic Object </typeparam>
|
|
public interface IDataServices<TObject>
|
|
{
|
|
/// <summary>
|
|
/// Get a list of data, filtered or not, and paginated results
|
|
/// </summary>
|
|
/// <returns> An Enumerable of generic object </returns>
|
|
public Task<IEnumerable<TObject?>> GetList();
|
|
|
|
/// <summary>
|
|
/// Get an object based on its identifier
|
|
/// </summary>
|
|
/// <param name="id"> Identifier (Guid.ToString()) </param>
|
|
/// <returns> The object or null if the id is incorrect </returns>
|
|
public Task<TObject?> GetDataById(string id);
|
|
|
|
/// <summary>
|
|
/// Add an object to the database
|
|
/// </summary>
|
|
/// <param name="data"> Object to add </param>
|
|
/// <returns> The object added </returns>
|
|
public Task<TObject> CreateData(TObject data);
|
|
|
|
/// <summary>
|
|
/// Modify an object in the database
|
|
/// </summary>
|
|
/// <param name="data"> Object to modify </param>
|
|
/// <param name="id"> Identifier (Guid.ToString()) </param>
|
|
/// <returns> The object modified </returns>
|
|
public Task<TObject?> UpdateData(TObject data, string id);
|
|
|
|
/// <summary>
|
|
/// Delete an object from the database
|
|
/// </summary>
|
|
/// <param name="id"> Identifier (Guid.ToString()) </param>
|
|
/// <returns> true if the object has been deleted, false otherwise </returns>
|
|
public Task<bool> DeleteById(string id);
|
|
} |