Beispiel #1
0
        public beGreen.Model.Response.ProfileResponse GetByID(string id)
        {
            beGreen.Model.Response.ProfileResponse result = null;

            using (SqlConnection connection = new SqlConnection(Connection.String))
            {
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "ProfileGetByID";

                command.Parameters.Add(new SqlParameter("@id", id));

                connection.Open();

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        result = MapResponse(reader);
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
        private beGreen.Model.Response.ProfileResponse MapResponse(SqlDataReader data)
        {
            beGreen.Model.Response.ProfileResponse result = new beGreen.Model.Response.ProfileResponse();

            result.ID    = data["ID"].ToString();
            result.Name  = data["Name"].ToString();
            result.DOB   = DateTime.Parse(data["DOB"].ToString());
            result.Role  = data["Role"].ToString();
            result.Email = data["Email"].ToString();
            //result.Email = data["email"].ToString();

            return(result);
        }