56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using gehGassi.Core.Interfaces;
|
|
using gehGassi.Domain.Common;
|
|
using gehGassi.Domain.Feedback;
|
|
|
|
namespace gehGassi.Core.Services
|
|
{
|
|
/// <summary>
|
|
/// Service der die Verwaltung von Feedbacks aus der App ermöglicht
|
|
/// </summary>
|
|
public class AppFeedbackService : ServiceBase<AppFeedback>, IAppFeedbackService
|
|
{
|
|
/// <summary>
|
|
/// Erstellt eine Instanz
|
|
/// </summary>
|
|
/// <param name="unitOfWork">Instanz eines IUnitOfWork</param>
|
|
public AppFeedbackService(IUnitOfWork unitOfWork) : base(unitOfWork)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Erstellen eines Feedback
|
|
/// </summary>
|
|
/// <returns>AppFeedback</returns>
|
|
public AppFeedback Create()
|
|
{
|
|
var item = new AppFeedback();
|
|
return item;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gibt eine gefilterte Liste von Feedback zurück
|
|
/// </summary>
|
|
/// <param name="filter">Filterbegriff der in bestimmten Feldern gesucht wird</param>
|
|
/// <returns>List betroffener Feedbacks</returns>
|
|
public IQueryable<AppFeedback> Filter(string filter)
|
|
{
|
|
return Repository.Query(c => c.UserName.Contains(filter) || c.Name.Contains(filter));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gibt die Anzahl von Feedbacks in einem bestimmten Status zurück
|
|
/// </summary>
|
|
/// <param name="status">Gewünschter Status</param>
|
|
/// <returns>Anzahl Feedbacks im Status</returns>
|
|
public async Task<int> CountAsync(AppFeedbackStatus status)
|
|
{
|
|
return await Repository.CountAsync(c => c.Status == status).ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|