Example #1
0
 public static DomainUser ToDomain(this SqlUser model)
 {
     return(new DomainUser
     {
         Id = model.Id,
         Name = model.Name,
         LastName = model.LastName,
         Email = model.Email,
         Password = model.Password,
         Type = model.Type
     });
 }
Example #2
0
        public override void Create(DomainUser domain)
        {
            SqlUser _user = domain.ToSql();

            string queryStr =
                $"INSERT INTO {_userTableStr}" +
                $" (Name, LastName, Email, Password, Type) VALUES" +
                $" ('{_user.Name.ToString()}', '{domain.LastName.ToString()}', '{domain.Email.ToString()}'," +
                $" '{domain.Password.ToString()}', {domain.Type})";

            using (var con = new SqlConnection(connectionString))
            {
                con.Query(queryStr).FirstOrDefault();
            }
        }