I'm getting the following error:
Can not convert from "TClient" to "EasySystem.Models.ApplicationClient"
public class ClientManager<TClient>
{
private ApplicationDbContext _context;
public ClientManager(ApplicationDbContext context)
{
_context = context;
}
public virtual async Task CreateClientAsync(TClient client)
{
var result = await _context.Clientes.Add(client);
if (result.Succeeded)
{
_context.SaveChanges();
}
return Task.FromResult(result);
}
}
The call is being made through:
var result = await _clientManager.CreateClientAsync(client);
This is the definition of _clientManager:
private readonly ClientManager<ApplicationClient> _clientManager;
public ClientController (
ClientManager<ApplicationClient> clientManager)
{
_userManager = userManager;
}
ApplicationDbContext:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, ApplicationRole, Guid, ApplicationUserClaim, ApplicationUserRole,
ApplicationUserLogin, ApplicationRoleClaim, ApplicationUserToken>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public virtual DbSet<ApplicationClient> Clientes { get; set; }
And this is my ApplicationClient:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace EasySistema.Models
{
public class ApplicationClient
{
[Key]
public Guid Id { get; set; }
[Required]
[Display(Name = "Tipo Pessoa")]
public int TipoPessoa { get; set; }
}
Please help me, because I can not see where I'm going wrong, and I can not solve it.