@ -1,65 +1,65 @@
using DbContextLib ;
using DbContextLib ;
using Model.DTO ;
using Model.DTO ;
using System ;
using System ;
using System.Collections.Generic ;
using System.Collections.Generic ;
using System.Linq ;
using System.Linq ;
using System.Text ;
using System.Text ;
using System.Threading.Tasks ;
using System.Threading.Tasks ;
using Model.Mappers ;
using Model.Mappers ;
using Model.Business ;
using Model.Business ;
using Microsoft.EntityFrameworkCore ;
using Microsoft.EntityFrameworkCore ;
using Entities.SQLudeoDB ;
using Entities.SQLudeoDB ;
using ModelToEntity ;
using ModelToEntity ;
namespace Services
namespace Services
{
{
public class UserDataService : IDataService
public class UserDataService : IDataService
{
{
private UserDbContext DbContext { get ; set ; }
private UserDbContext DbContext { get ; set ; }
private readonly IDataServiceEF dataServiceEF ;
private readonly IDataServiceEF dataServiceEF ;
public UserDataService ( IDataServiceEF dataServiceEF )
public UserDataService ( IDataServiceEF dataServiceEF )
{
{
this . dataServiceEF = dataServiceEF ;
this . dataServiceEF = dataServiceEF ;
}
}
public async Task < UserDTO > GetUserById ( int id )
public async Task < UserDTO > GetUserById ( int id )
{
{
var user = await dataServiceEF . GetUserById ( id ) ;
var user = await dataServiceEF . GetUserById ( id ) ;
return user . FromModelToDTO ( ) ;
return user . FromModelToDTO ( ) ;
}
}
public async Task < UserDTO > GetUserByUsername ( string username )
public async Task < UserDTO > GetUserByUsername ( string username )
{
{
var user = await dataServiceEF . GetUserByUsername ( username ) ;
var user = await dataServiceEF . GetUserByUsername ( username ) ;
return user . FromModelToDTO ( ) ;
return user . FromModelToDTO ( ) ;
}
}
public async Task < IEnumerable < UserDTO > > GetUsers ( int page , int number )
public async Task < IEnumerable < UserDTO > > GetUsers ( int page , int number )
{
{
var users = await dataServiceEF . GetUsers ( page , number ) ;
var users = await dataServiceEF . GetUsers ( page , number ) ;
return users . Select ( u = > u . FromModelToDTO ( ) ) ;
return users . Select ( u = > u . FromModelToDTO ( ) ) ;
}
}
public async Task < bool > DeleteUser ( int id )
public async Task < bool > DeleteUser ( int id )
{
{
var respons = await dataServiceEF . DeleteUser ( id ) ;
var respons = await dataServiceEF . DeleteUser ( id ) ;
return respons ;
return respons ;
}
}
public async Task < UserDTO > UpdateUser ( int id , UserDTO user )
public async Task < UserDTO > UpdateUser ( int id , UserDTO user )
{
{
var updatingUser = await dataServiceEF . UpdateUser ( id , user ) ;
var updatingUser = await dataServiceEF . UpdateUser ( id , user ) ;
return updatingUser . FromModelToDTO ( ) ;
return updatingUser . FromModelToDTO ( ) ;
}
}
public async Task < UserDTO > CreateUser ( string username , string password , string email , bool isAdmin )
public async Task < UserDTO > CreateUser ( string username , string password , string email , bool isAdmin )
{
{
var newUserEntity = await dataServiceEF . CreateUser ( username , password , email , isAdmin ) ;
var newUserEntity = await dataServiceEF . CreateUser ( username , password , email , isAdmin ) ;
return newUserEntity . FromModelToDTO ( ) ;
return newUserEntity . FromModelToDTO ( ) ;
}
}
public IEnumerable < InquiryDTO > GetInquiries ( int page , int number )
public IEnumerable < InquiryDTO > GetInquiries ( int page , int number )
{
{
throw new NotImplementedException ( ) ;
throw new NotImplementedException ( ) ;
}
}
public InquiryDTO GetInquiryById ( int id )
public InquiryDTO GetInquiryById ( int id )
@ -115,5 +115,65 @@ namespace Services
{
{
throw new NotImplementedException ( ) ;
throw new NotImplementedException ( ) ;
}
}
}
}
public Task < IEnumerable < ParagraphDTO > > GetParagraphs ( int page , int number )
{
throw new NotImplementedException ( ) ;
}
public Task < ParagraphDTO > GetParagraphById ( int id )
{
throw new NotImplementedException ( ) ;
}
public Task < ParagraphDTO > GetParagraphByTitle ( string title )
{
throw new NotImplementedException ( ) ;
}
public Task < bool > DeleteParagraph ( int id )
{
throw new NotImplementedException ( ) ;
}
public Task < ParagraphDTO > UpdateParagraph ( int id , ParagraphDTO paragraphDTO )
{
throw new NotImplementedException ( ) ;
}
public Task < ParagraphDTO > CreateParagraph ( string title , string content , string info , string query , string comment )
{
throw new NotImplementedException ( ) ;
}
public Task < IEnumerable < UserDTO > > GetSuccesses ( int page , int number )
{
throw new NotImplementedException ( ) ;
}
public Task < UserDTO > GetSuccessByUserId ( int id )
{
throw new NotImplementedException ( ) ;
}
public Task < UserDTO > GetSuccessByInquiryId ( int id )
{
throw new NotImplementedException ( ) ;
}
public Task < bool > DeleteSuccess ( int id )
{
throw new NotImplementedException ( ) ;
}
public Task < UserDTO > UpdateSuccess ( int id , SuccessDTO success )
{
throw new NotImplementedException ( ) ;
}
public Task < UserDTO > CreateSuccess ( int userId , int inquiryId , bool isFinished )
{
throw new NotImplementedException ( ) ;
}
}
}