public SuperHuman Convert(CreateSuperHumanRequest source) { var result = default(SuperHuman); if (source != null) { result = new SuperHuman { Name = source.Name, Type = source.Type }; } return(result); }
public SuperHumanResponse Convert(SuperHuman source) { var result = default(SuperHumanResponse); if (source != null) { result = new SuperHumanResponse { Name = source.Name, Id = source.Id }; } return(result); }
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); }
public async Task <SuperHuman> AddHuman(SuperHuman superHuman) { superHuman.Id = Guid.NewGuid(); return(await this.iManageSuperHumanRepository.Add(superHuman)); }