2020-12-05 21:58:45 +01:00
|
|
|
|
using AutoMapper;
|
|
|
|
|
using SessionCompanion.Database.Repositories.Base;
|
|
|
|
|
using SessionCompanion.Database.Tables;
|
|
|
|
|
using SessionCompanion.Services.Base;
|
|
|
|
|
using SessionCompanion.Services.Interfaces;
|
|
|
|
|
using SessionCompanion.ViewModels.UserViewModels;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace SessionCompanion.Services.Services
|
|
|
|
|
{
|
|
|
|
|
public class UserService : ServiceBase<UserViewModel, User>, IUserService
|
|
|
|
|
{
|
|
|
|
|
public UserService(IMapper mapper, IRepository<User> repository) : base(mapper, repository)
|
|
|
|
|
{ }
|
2020-12-09 22:47:25 +01:00
|
|
|
|
|
|
|
|
|
public async Task<UserViewModel> SearchUserByNickname(string userName)
|
2020-12-09 23:09:57 +01:00
|
|
|
|
{
|
|
|
|
|
var User = await Repository.Get(u => u.Nickname.Equals(userName)).FirstOrDefaultAsync();
|
|
|
|
|
return Mapper.Map<UserViewModel>(User);
|
|
|
|
|
}
|
2020-12-05 21:58:45 +01:00
|
|
|
|
}
|
|
|
|
|
}
|