Exemple #1
0
        public SuperHuman Convert(CreateSuperHumanRequest source)
        {
            var result = default(SuperHuman);

            if (source != null)
            {
                result = new SuperHuman
                {
                    Name = source.Name,
                    Type = source.Type
                };
            }

            return(result);
        }
Exemple #2
0
        public SuperHumanResponse Convert(SuperHuman source)
        {
            var result = default(SuperHumanResponse);

            if (source != null)
            {
                result = new SuperHumanResponse
                {
                    Name = source.Name,
                    Id   = source.Id
                };
            }

            return(result);
        }
Exemple #3
0
        public async Task <SuperHuman> Add(SuperHuman superHuman)
        {
            using (SqlConnection connection = new SqlConnection(this.iProofConfiguration.ConnectionString))
            {
                connection.Open();
                string sql = "INSERT INTO TblSuperHuman(Id, Name, Type) VALUES(@id,@name,@type)";
                using (SqlCommand cmd = new SqlCommand(sql, connection))
                {
                    cmd.Parameters.AddWithValue("@id", superHuman.Id);
                    cmd.Parameters.AddWithValue("@name", superHuman.Name);
                    cmd.Parameters.AddWithValue("@type", superHuman.Type);
                    cmd.CommandType = CommandType.Text;
                    await cmd.ExecuteNonQueryAsync();
                }
            }

            return(superHuman);
        }
Exemple #4
0
 public async Task <SuperHuman> AddHuman(SuperHuman superHuman)
 {
     superHuman.Id = Guid.NewGuid();
     return(await this.iManageSuperHumanRepository.Add(superHuman));
 }