From fee5b07fac6a696415c14e3dda3eaeca2ff2da50 Mon Sep 17 00:00:00 2001 From: Leni BEAULATON Date: Fri, 28 Mar 2025 11:51:28 +0100 Subject: [PATCH] Quote Services --- WF_EF_Api/ServicesApi/QuoteService.cs | 112 ++++++++++++++++++++++++++ WF_EF_Api/ServicesApi/UserService.cs | 3 +- 2 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 WF_EF_Api/ServicesApi/QuoteService.cs diff --git a/WF_EF_Api/ServicesApi/QuoteService.cs b/WF_EF_Api/ServicesApi/QuoteService.cs new file mode 100644 index 0000000..eee85b7 --- /dev/null +++ b/WF_EF_Api/ServicesApi/QuoteService.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DTO; +using Dto2Entities; +using Entity; +using Shared; + +namespace ServicesApi +{ + public class QuoteService : IQuoteService + { + private IQuoteService quoteService; + + public QuoteService(IQuoteService quote) + { + quoteService = quote; + } + + public async Task AddQuote(QuoteDTO quote) + { + await quoteService.AddQuote(quote.ToEntity()); + } + + public async Task> GetAllQuote() + { + throw new NotImplementedException(); + } + + public async Task> GetAllQuoteLang(int index, int pageSize, int lang) + { + throw new NotImplementedException(); + } + + public async Task GetDailyQuote(DateOnly date, int lang) + { + return quoteService.GetDailyQuote(date, lang).Result.ToDto(); + } + + public async Task> GetFavorites(int index, int pageSize, int UserId) + { + throw new NotImplementedException(); + } + + public async Task> GetInvalidQuote(int index, int pageSize, int lang) + { + throw new NotImplementedException(); + } + + public async Task> GetInvalidQuote(int index, int pageSize) + { + throw new NotImplementedException(); + } + + public async Task GetLastQuoteId() + { + return await quoteService.GetLastQuoteId(); + } + + public async Task GetQuoteById(int id) + { + return quoteService.GetQuoteById(id).Result.ToDto(); + } + + public async Task> GetSomeQuote(int index, int pageSize) + { + throw new NotImplementedException(); + } + + public async Task> GetSuggestions(int index, int pageSize, int lang) + { + throw new NotImplementedException(); + } + + public async Task> GetValidQuote(int index, int pageSize) + { + throw new NotImplementedException(); + } + + public async Task RemoveQuote(int quoteId) + { + await quoteService.RemoveQuote(quoteId); + } + + public async Task> SearchByCharacter(string character, int index, int pageSize, int lang) + { + throw new NotImplementedException(); + } + + public async Task> SearchByContent(string content, int index, int pageSize, int lang) + { + throw new NotImplementedException(); + } + + public async Task> SearchBySource(string source, int index, int pageSize, int lang) + { + throw new NotImplementedException(); + } + + public async Task UpdateQuote(int quoteId, QuoteDTO quote) + { + await quoteService.UpdateQuote(quoteId, quote.ToEntity()); + } + + public async Task ValidateQuote(int quoteId, bool isValidate) + { + await quoteService.ValidateQuote(quoteId, isValidate); + } + } +} diff --git a/WF_EF_Api/ServicesApi/UserService.cs b/WF_EF_Api/ServicesApi/UserService.cs index 367cd2b..064fd63 100644 --- a/WF_EF_Api/ServicesApi/UserService.cs +++ b/WF_EF_Api/ServicesApi/UserService.cs @@ -87,8 +87,7 @@ namespace ServicesApi public async Task UpdateUser(int userId, UserDTO user) { - await userService.UpdateUser(userId, user.ToEntity()); - throw new NotImplementedException(); + return userService.UpdateUser(userId, user.ToEntity()).Result.ToDto(); } } }