title: Cannot convert from interface to class
body: <p>I had an error in my method when I try to add to the database my interface and it gives me the error, </p>
  
  <blockquote>
    <p>Argument 1: cannot convert from 'ForumSite.ActionsAndMethods.Registration.IRegistration' to 'ForumSite.Models.User'.</p>
  </blockquote>
  
  <p>Here is the code in <code>IRegistration</code>:</p>
  
  <pre><code> using ForumSite.Models;
   using System;
   using System.Collections.Generic;
   using System.Linq;
   using System.Text;
   using System.Threading.Tasks;
  
  namespace ForumSite.ActionsAndMethods.Registration
  {
  public interface IRegistration
  {
      int UserId { get; }
      string Email { get; }
      string Password { get; }
      string FirstName { get; }
      string LastName { get; }
      DateTime Birthday { get; }
      DateTime DateCreated { get; set; }
      string MobileNumber { get; }
      string Address { get; }
      int UserIsDeleted { get; set; }
      int UserRoleId { get; set; }
      UserRole UserRole { get; }
  }
  }
  </code></pre>
  
  <p>And this is the code in my model:</p>
  
  <pre><code>namespace ForumSite.Models
  {
  using ActionsAndMethods.Registration;
  using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  
  public partial class User : IRegistration
  {
      public int UserId { get; set; }
      [Display(Name = "Email Address")]
      [Required(ErrorMessage = "This field required.")]
      [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@([a-zA-Z]+)\.([a-zA-Z]{2,5})$", ErrorMessage = "Enter Valid Email Address")]
      [StringLength(50, MinimumLength = 8, ErrorMessage = "8 to 50 characters only")]
      public string Email { get; set; }
  
      [Display(Name = "Password")]
      [Required(ErrorMessage = "This field required.")]
      [RegularExpression(@"^[a-zA-Z0-9]+$", ErrorMessage = "Alphanumeric characters only")]
      [StringLength(50, MinimumLength = 8, ErrorMessage = "8 to 50 characters only")]
      public string Password { get; set; }
  
      [Display(Name = "Confirm Password")]
      [Required(ErrorMessage = "This field required.")]
      [RegularExpression(@"^[a-zA-Z0-9]+$", ErrorMessage = "Alphanumeric characters only")]
      [StringLength(50, MinimumLength = 8, ErrorMessage = "8 to 50 characters only")]
      public string PasswordConfirm { get; set; }
  
      [Display(Name = "First Name")]
      [Required(ErrorMessage = "This field required.")]
      [RegularExpression(@"^[a-zA-Z\s]+$", ErrorMessage = "Letters Only.")]
      public string FirstName { get; set; }
  
      [Display(Name = "Last Name")]
      [Required(ErrorMessage = "This field required.")]
      [RegularExpression(@"^[a-zA-Z\s]+$", ErrorMessage = "Letters Only.")]
      public string LastName { get; set; }
  
      [Display(Name = "Birthday")]
      [Required(ErrorMessage = "This field required.")]
      public DateTime Birthday { get; set; }
      public DateTime DateCreated { get; set; }
  
      [Display(Name = "Mobile Number")]
      [Required(ErrorMessage = "This field required.")]
      [RegularExpression(@"^[0-9]+$", ErrorMessage = "Numeric input only.")]
      public string MobileNumber { get; set; }
  
      [Display(Name = "Address")]
      [Required(ErrorMessage = "This field required.")]
      public string Address { get; set; }
      public int UserIsDeleted { get; set; }
      public int UserRoleId { get; set; }
  
      public UserRole UserRole { get; set; }
  }
  }
  </code></pre>
  
  <p>And lastly, my method which adds the user to my database:</p>
  
  <pre><code>using ForumSite.ActionsAndMethods.Registration;
  using ForumSite.Models;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace ForumSite.ActionsAndMethods
  {
  public class RegisterAction : IRegistration
  {
      ForumDBEntities ent = new ForumDBEntities();
      public void Registration(IRegistration reg)
      {
          reg.DateCreated = DateTime.Now;
          reg.UserRoleId = 1;
          reg.UserIsDeleted = 0;
  
          ent.Users.Add(reg);
          ent.SaveChanges();
      }
  
      string IRegistration.Address { get; }
      int IRegistration.UserId { get; }
      string IRegistration.Email { get; }
      string IRegistration.Password { get; }
      string IRegistration.FirstName { get; }
      string IRegistration.LastName { get; }
      DateTime IRegistration.Birthday { get; }
      DateTime IRegistration.DateCreated { get; set; }
      string IRegistration.MobileNumber { get; }
      int IRegistration.UserIsDeleted { get; set; }
      int IRegistration.UserRoleId { get; set; }
  
      UserRole IRegistration.UserRole { get; }
  }
  
  }
  </code></pre>
  
  <p>I wonder what causes this error?</p>